Snapshot background synchronization method and apparatus, electronic device, and storage medium

By partitioning and evenly distributing source volume data to the controllers of a multi-controller storage system, the problem of resource waste in existing technologies is solved, and the speed of snapshot background synchronization is improved.

CN116804979BActive Publication Date: 2026-07-31INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR SUZHOU INTELLIGENT TECH CO LTD
Filing Date
2023-06-28
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing technologies select one controller as the owner controller for snapshots in dual-controller or multi-controller storage systems and perform background data copying tasks only on that controller, resulting in wasted resources and reduced snapshot background synchronization speed.

Method used

The source volume data is divided into N data parts and evenly distributed to N controllers of the multi-controller storage system, so that each controller is responsible for synchronizing at least one data part and synchronizing it to the target volume through background copying.

Benefits of technology

By making full use of the controller resources of the multi-controller storage system, the speed of snapshot background synchronization is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116804979B_ABST
    Figure CN116804979B_ABST
Patent Text Reader

Abstract

This invention provides a snapshot background synchronization method, apparatus, electronic device, and storage medium, belonging to the field of computer technology. The snapshot background synchronization method includes: dividing source volume data into N data parts; where N is a natural number greater than 1; evenly distributing the N data parts to N controllers of a multi-controller storage system, such that each controller is responsible for synchronizing at least one data part; and synchronizing the data part handled by each controller to the target volume via background copying. This invention fully utilizes the controller resources of the multi-controller storage system, improving the speed of snapshot background synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a snapshot background synchronization method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the rapid development of computer technology, the requirements for the reliability and security of data in storage devices are becoming increasingly stringent. Snapshots not only enable online data backup and recovery but also provide storage users with another data access channel. For almost all high, medium, and low-end storage systems, snapshots are an indispensable function. Background copying refers to copying data blocks from the source volume to the target volume sequentially at a certain rate and order. Current technology typically selects one controller as the owner controller for snapshots in dual-controller or multi-controller storage systems, and only performs background copying tasks on the owner controller. Other non-owner controllers do not play their role in background copying, resulting in a waste of resources in multi-controller storage systems and significantly reducing the speed of snapshot background synchronization. Summary of the Invention

[0003] This invention provides a snapshot background synchronization method, apparatus, electronic device, and storage medium to solve the problem that in existing dual-controller or multi-controller storage systems, only one controller is selected as the owner controller for the snapshot, and the background copying task of data is only performed on the owner controller, which causes resource waste in the multi-controller storage system and greatly reduces the speed of snapshot background synchronization.

[0004] In a first aspect, the present invention provides a snapshot background synchronization method, comprising:

[0005] The source volume data is divided into N data parts; where N is a natural number greater than 1.

[0006] The N data portions are evenly distributed among the N controllers of the multi-controller storage system, so that each controller is responsible for synchronizing at least one data portion.

[0007] The data portion handled by each controller is synchronized to the target volume via background copying.

[0008] In some embodiments, the step of evenly distributing the N data portions to the N controllers of the multi-controller storage system includes:

[0009] During initialization, a data section is allocated to each of the N controllers, with a one-to-one correspondence between the controller and the data section;

[0010] If a faulty controller exists among the N controllers, the data portion handled by the faulty controller is reassigned to a target controller, which is any controller among the non-faulty controllers that handles the fewest data portions.

[0011] In some embodiments, the step of evenly distributing the N data portions to the N controllers of the multi-controller storage system further includes:

[0012] After the fault controller returns to normal, the data portion that the fault controller was responsible for is redistributed to the fault controller.

[0013] In some embodiments, synchronizing the data portion managed by each controller to the target volume via background copy includes:

[0014] Repeat the following steps until the synchronization of the data portion handled by each controller is complete:

[0015] If the background copy speed of the snapshot is detected to change from 0 to greater than 0, or if the data copy status indicator changes, the first data portion that has not been copied is determined based on the data copy status indicator.

[0016] If it is determined that the first incomplete copy of the data portion exists, then the identifier of the next data portion that needs to be copied in the background is set to the number of the first incomplete copy of the data portion;

[0017] Based on the identifier of the next data part that needs to be copied in the background, the data part that each controller needs to copy is determined from the data part that each controller is responsible for, and each controller is notified so that each controller can start its own background synchronization thread to synchronize the data part that needs to be copied to the target volume in the background copy mode.

[0018] Upon receiving a copy completion notification message from the controller, update the bit position of the data portion corresponding to the copy completion notification message in the data portion copy status identifier;

[0019] The data copy status identifier is used to indicate the copy status of the data portion managed by each controller, with each bit representing the copy status of a data portion.

[0020] The identifier for the next data portion to be copied in the background is used to indicate the number of the next data portion to be copied in the background.

[0021] In some embodiments, determining the data portion that each controller needs to copy from the data portions managed by each controller based on the identifier of the next data portion to be copied in the background includes:

[0022] Iterate through all controllers. For each controller, arrange the numbers of all data parts it is responsible for in ascending order. Determine the first data part whose number is greater than or equal to the identifier of the next data part to be copied in the background, and use it as the data part that each controller needs to copy.

[0023] In some embodiments, dividing the source volume data into N data portions includes:

[0024] Divide the source volume data into multiple data blocks of equal size;

[0025] Based on the position of the multiple data blocks in the source volume, the multiple data blocks are numbered in ascending order;

[0026] Take the remainder of the number corresponding to each data block with respect to the value of N;

[0027] Data blocks with the same remainder are grouped into a single data part, resulting in N data parts.

[0028] In some embodiments, the method further includes:

[0029] Obtain the background copy progress reported in real time by each controller during data synchronization;

[0030] The background copy progress feedback from all controllers is aggregated to obtain the overall background copy progress, which is then fed back to the user.

[0031] In a second aspect, the present invention provides a snapshot background synchronization device, comprising:

[0032] A data partitioning unit is used to divide the source volume data into N data parts; where N is a natural number greater than 1.

[0033] A data allocation unit is used to evenly distribute the N data portions to the N controllers of the multi-controller storage system, so that each controller is responsible for the synchronization of at least one data portion.

[0034] The data synchronization unit is used to synchronize the data portion of each controller to the target volume via background copying.

[0035] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the snapshot background synchronization method as described above.

[0036] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the snapshot background synchronization method as described above.

[0037] The present invention provides a snapshot background synchronization method, apparatus, electronic device and storage medium, which divides the source volume data into N data parts and distributes the N data parts evenly to the N controllers of a multi-controller storage system so that each controller is responsible for synchronizing at least one data part. The data part responsible for each controller is synchronized to the target volume through background copying, which makes full use of the controller resources of the multi-controller storage system and improves the speed of snapshot background synchronization. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0039] Figure 1 This is one of the flowcharts of the snapshot background synchronization method provided in the embodiments of the present invention;

[0040] Figure 2 This is a schematic diagram of the process of synchronizing the data portion of each controller to the target volume through a background copy method, as provided in an embodiment of the present invention;

[0041] Figure 3 This is an example of dividing source volume data into N data parts, provided in an embodiment of the present invention;

[0042] Figure 4 This is a second flowchart illustrating the snapshot background synchronization method provided in this embodiment of the invention;

[0043] Figure 5 This is a schematic diagram of the snapshot background synchronization device provided by the present invention;

[0044] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0046] A snapshot is a copy of a specified dataset at a specific point in time; it is a fully usable copy. Snapshot technology divides the source volume into data blocks of equal size. After a snapshot is generated for a source volume, data synchronization is performed between the source and target volumes. Snapshot technology uses two copy methods: copy-on-write and background copy. Background copy refers to copying data from each data block in the source volume to the corresponding data block in the target volume at a certain rate, according to the data block's position in the source volume in ascending order.

[0047] If the user specifies a background copy rate greater than 0 for a snapshot, the system will start a background task thread for that snapshot to copy all data blocks in that snapshot. A watermark will be set to record which data block is currently being copied, incrementing the watermark by 1 for each copied data block. Since background data synchronization must be performed in ascending order of data blocks within the volume, in multi-controller storage systems, to avoid two controllers operating on the same data block simultaneously and to prevent order confusion, the system will select one controller as the snapshot's owner controller and perform background synchronization tasks only on the owner controller. This does not fully utilize other non-owner controllers, significantly reducing the speed of snapshot background synchronization.

[0048] To address this, the present invention provides a snapshot background synchronization method, apparatus, electronic device, and storage medium. By dividing the source volume data into N data portions and evenly distributing these N data portions across N controllers of a multi-controller storage system, each controller is responsible for synchronizing at least one data portion. The data portion handled by each controller is then synchronized to the target volume via background copying. This invention can fully utilize the controller resources of the multi-controller storage system, thereby improving the speed of snapshot background synchronization.

[0049] Figure 1 This is one of the flowcharts illustrating the snapshot background synchronization method provided in an embodiment of the present invention. For example... Figure 1 As shown, a snapshot background synchronization method is provided, including the following steps: step 110, step 120, and step 130. This method's steps are merely one possible implementation of the present invention.

[0050] Step 110: Divide the source volume data into N data parts; where N is a natural number greater than 1.

[0051] Source volume data refers to a complete backup of the data on a volume in a storage system at a specific point in time, stored on another storage medium. This backup is typically used for data recovery. When data in the system fails or is lost, snapshot source volume data can be used to recover the data, allowing the system to continue operating normally.

[0052] Optionally, the N data portions are numbered in ascending order based on their positions in the source volume.

[0053] It's understandable that dividing the source volume data into N parts is for the convenience of handling large amounts of data. The specific partitioning method can be determined based on the application scenario and data type. Common partitioning methods include partitioning by time, by size, or by content characteristics. During partitioning, it's necessary to ensure that there is no data duplication between each part and that the source volume data can be completely restored. At the same time, it's also necessary to consider the possibility of data loss or corruption during the partitioning process to ensure data integrity and reliability.

[0054] Step 120: Distribute the N data portions evenly among the N controllers of the multi-controller storage system, so that each controller is responsible for synchronizing at least one data portion.

[0055] Multi-controller storage systems refer to storage systems with multiple controllers that can access storage devices simultaneously, thereby improving the system's performance and reliability. Multi-controller storage systems typically use redundant controllers to ensure fault tolerance and can also provide better load balancing and fault tolerance through multi-path access. Furthermore, multi-controller storage systems can offer higher storage capacity and scalability to meet the needs of application scenarios of different scales and requirements.

[0056] It is understandable that by evenly distributing the N data portions to the N controllers of the multi-controller storage system, so that each controller is responsible for synchronizing at least one data portion, the background copying task of the data can be executed simultaneously on multiple controllers, thereby improving the background synchronization speed of the N data portions.

[0057] Alternatively, distributed algorithms, such as hash functions or distributed hash tables, can be used to distribute data portions among different controllers. This approach can effectively balance the load while ensuring data consistency and recoverability.

[0058] Step 130: Synchronize the data portion handled by each controller to the target volume via background copy.

[0059] Background copying refers to copying data portions to the target volume sequentially at a certain rate, according to the ascending order of the data portion numbers managed by each controller. Background copying is a method within snapshot technology; it creates a snapshot by copying the source data and saving it to the snapshot through a background process, without stopping application or system operations. This makes snapshot creation faster and more efficient, and does not affect running systems or applications.

[0060] It should be noted that before synchronizing the data portion handled by each controller to the target volume via background copy, it is usually necessary to create a snapshot mapping relationship between the source volume and the target volume. This can be achieved by performing feature matching between the source volume and the target volume to determine their correspondence.

[0061] Understandably, synchronizing the data portion handled by each controller to the target volume via background copying allows multiple controllers to simultaneously execute background copying tasks for their respective data portions, thereby improving the background copying speed of the data portions.

[0062] In this embodiment of the invention, by dividing the source volume data into N data parts and distributing the N data parts evenly to the N controllers of the multi-controller storage system, each controller is responsible for synchronizing at least one data part. The data part responsible for each controller is synchronized to the target volume through background copying, which makes full use of the controller resources of the multi-controller storage system and improves the speed of snapshot background synchronization.

[0063] It should be noted that each embodiment of the present invention can be freely combined, rearranged, or executed individually, and does not need to rely on or depend on a fixed execution order.

[0064] In some embodiments, distributing N data portions evenly across N controllers of a multi-controller storage system includes:

[0065] During initialization, a data section is allocated to each of the N controllers, with a one-to-one correspondence between the controller and the data section;

[0066] If there is a faulty controller among the N controllers, the data portion handled by the faulty controller is redistributed to the target controller, which is any controller that handles the fewest data portions among the controllers that have not failed.

[0067] For example, during initialization, the four data sections "section1, section2, section3, and section4" are evenly distributed among the four controllers: controller 1 is responsible for "section1", controller 2 is responsible for "section2", controller 3 is responsible for "section3", and controller 4 is responsible for "section4". If controller 1 fails, the "section1" it is responsible for is reassigned to any one of controllers 2, 3, and 4. If both controller 1 and controller 2 fail, "section1" is reassigned to controller 3 and "section2" is reassigned to controller 4, or "section1" is reassigned to controller 4 and "section2" is reassigned to controller 3.

[0068] Optionally, the data portions handled by the faulty controllers can be redistributed to the target controllers with the fewest data portions in ascending order of the number of data portions handled by the controllers that have not failed, until all data portions handled by the faulty controllers have been redistributed. This ensures that the controllers that have not failed can balance the load across the N data portions and preserves the original data distribution relationships as much as possible, reducing system instability.

[0069] It should be noted that during the fault handling process, apart from the fault controller and the target controller, other controllers are unaffected and can continue to perform background data synchronization for the data they are responsible for.

[0070] Understandably, during initialization, by assigning a data portion to each of the N controllers, the load on the N data portions can be balanced across the N controllers. This maximizes the performance advantages of the multi-controller storage system, ensuring that all controllers can fulfill their roles and reach their performance limits, preventing excessive pressure on the owner controller and its impact on host service performance. In the event of a faulty controller among the N controllers, the data portion handled by the faulty controller is reassigned to a target controller. The target controller is any controller among the non-faulty controllers that handles the fewest data portions. This ensures that all data portions can complete background data synchronization, thereby reducing the impact of the faulty controller on existing services.

[0071] In some embodiments, distributing N data portions evenly across N controllers of a multi-controller storage system further includes:

[0072] After the fault controller returns to normal, the data portion that was previously handled by the fault controller will be redistributed to the fault controller.

[0073] Understandably, after the fault controller recovers, the original data allocation relationship can be preserved and the system instability can be reduced by redistributing the data portion that the fault controller was responsible for to the fault controller.

[0074] Figure 2 This is a schematic diagram illustrating the process of synchronizing the data portion handled by each controller to the target volume via background copying, as provided in an embodiment of the present invention. Figure 2 As shown, in some embodiments, step 130 synchronizes the data portion handled by each controller to the target volume via a background copy method, including:

[0075] Repeat the following steps until the synchronization of the data portion handled by each controller is complete:

[0076] Step 131: If the background copy speed of the snapshot changes from 0 to greater than 0, or the data copy status indicator changes, determine the first data part that has not been copied incompletely based on the data copy status indicator.

[0077] Optionally, the data copy status identifier can be represented by the section_copied variable. section_copied includes bit values, i.e., bits. Each bit value represents the copy status of a data part. If a data part has been copied, its corresponding bit is 1. If a data part has not been copied, its corresponding bit is 0. The initial value of the bit is set to 0.

[0078] The first incomplete copy of data refers to the data portion with the smallest number among all incomplete copy data portions.

[0079] It should be noted that if the background copy speed of the snapshot changes from 0 to greater than 0, it means that the user has modified the copy speed. A background copy speed of 0 indicates that background synchronization is off, while a speed greater than 0 indicates that background synchronization is on. A change in the data copy status flag indicates that a certain data part has been copied and the copying of the next data part can begin.

[0080] Step 132: If it is determined that the first incomplete copy of the data portion exists, then set the identifier of the next data portion that needs to be copied in the background to the number of the first incomplete copy of the data portion.

[0081] Optionally, the identifier of the next data section to be copied in the background can be represented by the variable section_need_to_copy. The initial value of section_need_to_copy is set to -1. If the number of the first data section that has not been copied is 1, then section_need_to_copy = 1.

[0082] Step 133: Identify the data portion to be copied in the background based on the data portion to be copied in the background. Determine the data portion that each controller needs to copy from the data portion that each controller is responsible for, and notify each controller so that each controller can start its own background synchronization thread to synchronize the data portion that needs to be copied to the target volume in the background copy mode.

[0083] Optionally, after receiving a notification that a data portion needs to be copied, each controller will determine whether the copying of that data portion is already in progress. If so, no action is taken; if the copying of other data portions is currently in progress, the copying of other data portions is stopped, and the background copying of that data portion is performed. After the copying of a data portion is completed, a copy completion notification message is sent to the system.

[0084] It should be noted that by identifying the data portion to be copied in the background, the data portion that each controller needs to copy can be determined. The data portion that each controller needs to copy is then notified to the corresponding controller, so that each controller can simultaneously synchronize the data portion that needs to be copied to the target volume through the background copy method.

[0085] Step 134: Upon receiving a copy completion notification message from the controller, update the bit in the data part copy status identifier corresponding to the copy completion notification message.

[0086] The data copy status identifier is used to indicate the copy status of the data portion managed by each controller, with each bit representing the copy status of one data portion.

[0087] Optionally, if a data portion has been copied, its corresponding bit is updated to 1.

[0088] The identifier for the next data section to be copied in the background is used to indicate the number of the next data section to be copied in the background.

[0089] For example, if the next data segment to be copied in the background is numbered 1, then the next data segment to be copied in the background is identified as 1.

[0090] Understandably, upon receiving a copy completion notification message from the controller, the system updates the bit in the data portion copy status identifier corresponding to the copy completion notification message, thereby updating the identifier of the next data portion that needs to be copied in the background, so that the next data portion can continue to be copied in the background.

[0091] In this embodiment of the invention, if the background copy speed of the snapshot changes from 0 to greater than 0, or if the data partial copy status identifier changes, the first incomplete copy data part is determined based on the data partial copy status identifier. If the existence of the first incomplete copy data part is determined, the identifier of the next data part to be copied in the background is set to the number of the first incomplete copy data part. Based on the identifier of the next data part to be copied in the background, the data part that each controller needs to copy is determined from the data parts managed by each controller, and notified to each controller. This allows each controller to start its own background synchronization thread to synchronize the data part that needs to be copied to the target volume through background copy. Upon receiving the copy completion notification message from the controller, the bit of the data part corresponding to the copy completion notification message in the data partial copy status identifier is updated. This enables the background synchronization task of data to be executed automatically on multiple controllers simultaneously, greatly improving the data background synchronization rate.

[0092] In some embodiments, based on the identifier of the next data portion to be copied in the background, the data portion that each controller needs to copy is determined from the data portion that each controller is responsible for, including:

[0093] Iterate through all controllers. For each controller, arrange the numbers of all data parts it is responsible for in ascending order. Determine the first data part whose number is greater than or equal to the identifier of the next data part that needs to be copied in the background. This data part is the one that each controller needs to copy.

[0094] For example, a controller is responsible for two data sections, namely section1 and section3. These two data sections are numbered in ascending order as "1, 3". If the next data section to be copied to the background is identified as 1, then the first data section with a number greater than or equal to 1 is identified as section1. If the next data section to be copied to the background is identified as 2, then the first data section with a number greater than or equal to 2 is identified as section3.

[0095] Understandably, by arranging the numbers of all data parts managed by each controller in ascending order, it is possible to determine the first data part whose number is greater than or equal to the next data part that needs to be copied in the background, and then use this data part for background copying.

[0096] In some embodiments, the source volume data is divided into N data portions, including:

[0097] Divide the source volume data into multiple data blocks of equal size;

[0098] Based on the location of multiple data blocks in the source volume, the multiple data blocks are numbered in ascending order;

[0099] Take the remainder of the number corresponding to each data block with respect to the value of N;

[0100] Data blocks with the same remainder are grouped into a single data part, resulting in N data parts.

[0101] Figure 3 This is an example of dividing source volume data into N data parts, provided as an embodiment of the present invention. For example... Figure 3 As shown, the multi-controller storage system has four controllers. The source volume data is divided into 22 data blocks (grains) of equal size, numbered 1-22. The remainder of 22 divided by 4 is calculated as follows: Section 1 corresponds to the grains where the remainder of 22 divided by 4 is 1, namely grain 1, grain 5, grain 9, grain 13, grain 17, and grain 21; Section 2 corresponds to the grains where the remainder of 22 divided by 4 is 2, namely grain 2, grain 6, grain 10, grain 14, grain 18, and grain 22; Section 3 corresponds to the grains where the remainder of 22 divided by 4 is 3, namely grain 3, grain 7, grain 11, grain 15, and grain 19; and Section 4 corresponds to the grains where the remainder of 22 divided by 4 is 0, namely grain 4, grain 8, grain 12, grain 16, and grain 20.

[0102] Understandably, by dividing the source volume data into multiple data blocks of equal size, numbering these blocks in ascending order based on their position within the source volume, and taking the remainder of each block's number divided by N, data blocks with the same remainder are grouped into a single data portion, resulting in N data portions. This allows for better load balancing. Even if the host is performing sequential read / write operations, adjacent grains can be assigned to different controllers for synchronization. Therefore, this allocation method achieves better load balancing regardless of whether the host is performing random or sequential read / write operations. This allocation method is the preferred approach for handling host read / write operations.

[0103] In some embodiments, the snapshot background synchronization method further includes:

[0104] Get the real-time background copy progress feedback from each controller during data synchronization;

[0105] Summarize the background copy progress feedback from all controllers to obtain the overall background copy progress, and then provide the overall background copy progress feedback to the user.

[0106] First, set the following variables: progress, the overall background copy progress, with an initial value of 0; total_grain_count, the total number of snapshot grains, which is set after the snapshot is created; the section_grain_count[N] array, where each element represents the number of grains in the nth section, which is set after the snapshot is created and the sections are allocated; and the section_progress[N] array, where each element represents the synchronization progress of the nth section.

[0107] Secondly, set a background copy progress variable section_progress for each controller, update the section_progress for each controller in real time during the background copy process, and send a background copy progress notification.

[0108] Next, after receiving the background copy progress notification from the controller, the corresponding element in section_progress is updated, and then the overall background copy progress is calculated using the formula "progress=sum{section_progress[n]*section_grain_count[n]} / total_grain_count". Finally, the calculation result is notified to the user.

[0109] Figure 4 This is a second schematic flowchart of the snapshot background synchronization method provided in an embodiment of the present invention. Figure 4 As shown, it includes the following steps:

[0110] Step 401: Initialize settings;

[0111] Step 402: Set section_copied = 0 and section_need_to_copy = -1;

[0112] Step 403: Distribute each section evenly to each controller. The section that each controller is responsible for is denoted as the array own_section[N]. The sections in the array are sorted in ascending order of their serial numbers.

[0113] Step 404: The user adjusts the background copy speed;

[0114] Step 405: Update section_copied by setting the bit corresponding to the section that has been copied in the background to 1;

[0115] Step 406: A change in the background copy rate or section_copied was detected;

[0116] Step 407: Find the first section in section_copied that is equal to 0 from the least significant bit to the most significant bit, and record the section number that section_need_to_copy is equal to. If it is not found, the process ends.

[0117] Step 408: For each controller, iterate through the section array section[N] it is responsible for in ascending order, find the section with an number greater than or equal to section_need_to_copy, and notify the corresponding controller if found; otherwise, skip the controller.

[0118] Step 409: Controller 1 receives the notification to copy section 1, performs a background copy of section 1, and sends a notification that the copy of section 1 is complete after the copy is finished.

[0119] Step 410: Controller 2 receives the notification to copy section 2, performs a background copy of section 2, and sends a notification that the copy of section 2 is complete after the copy is finished.

[0120] Step 411: Similarly, when controller N receives the notification to copy section N, it performs a background copy of section N. After the copy is completed, it sends a notification that the copy of section N is complete.

[0121] Understandably, by initializing `section_copied` and `section_need_to_copy`, each section is evenly distributed among the controllers. When the user adjusts the background copy rate or `section_copied` is updated, a change in the background copy rate or `section_copied` is detected. The system finds the first section in `section_copied` that equals 0 from the least significant bit to the most significant bit and records the number of `section_need_to_copy` equal to that section. If no such section is found, the process ends. For each controller, the system iterates through the `section[N]` array it is responsible for from smallest to largest, finding a section with a number greater than or equal to `section_need_to_copy`. If a section is found, the corresponding controller is notified; otherwise, the controller is skipped. After receiving the notification to copy the section, each controller performs a background copy of the corresponding section. Once the copy is complete, a notification of completion is sent. This fully utilizes the controller resources of the multi-controller storage system and improves the speed of snapshot background synchronization.

[0122] The snapshot background synchronization device provided in the embodiments of the present invention is described below. The snapshot background synchronization device described below and the snapshot background synchronization method described above can be referred to in correspondence.

[0123] Figure 5 This is a schematic diagram of the snapshot background synchronization device provided by the present invention, as shown below. Figure 5 As shown, the snapshot background synchronization device 500 includes:

[0124] Data partitioning unit 510 is used to divide the source volume data into N data parts; where N is a natural number greater than 1.

[0125] The data allocation unit 520 is used to evenly distribute N data portions to the N controllers of the multi-controller storage system, so that each controller is responsible for the synchronization of at least one data portion.

[0126] The data synchronization unit 530 is used to synchronize the data portion handled by each controller to the target volume via background copying.

[0127] Optionally, the N data portions are evenly distributed among the N controllers of the multi-controller storage system, including:

[0128] During initialization, a data section is allocated to each of the N controllers, with a one-to-one correspondence between the controller and the data section;

[0129] If there is a faulty controller among the N controllers, the data portion handled by the faulty controller is redistributed to the target controller, which is any controller that handles the fewest data portions among the controllers that have not failed.

[0130] Optionally, the snapshot background synchronization device also includes:

[0131] The recovery processing unit is used to redistribute the data portion that the fault controller was responsible for to the fault controller after the fault controller has recovered to normal.

[0132] Optionally, the data portion handled by each controller can be synchronized to the target volume via background copying, including:

[0133] Repeat the following steps until the synchronization of the data portion handled by each controller is complete:

[0134] If the background copy speed of the snapshot changes from 0 to greater than 0, or if the data copy status indicator changes, the first data part that has not been copied is determined based on the data copy status indicator.

[0135] If it is determined that the first incomplete copy of data exists, then the identifier of the next data part that needs to be copied in the background is set to the number of the first incomplete copy of data.

[0136] Based on the identifier of the data portion that needs to be copied in the background, determine the data portion that each controller needs to copy from the data portion that each controller is responsible for, and notify each controller so that each controller can start its own background synchronization thread to synchronize the data portion that needs to be copied to the target volume through background copying.

[0137] Upon receiving a copy completion notification message from the controller, update the bit in the data copy status identifier corresponding to the data portion of the copy completion notification message.

[0138] The data copy status identifier is used to indicate the copy status of the data portion managed by each controller, with each bit representing the copy status of a data portion.

[0139] The identifier for the next data section to be copied in the background is used to indicate the number of the next data section to be copied in the background.

[0140] Optionally, based on the identifier of the next data portion to be copied in the background, the data portion that each controller needs to copy is determined from the data portions managed by each controller, including:

[0141] Iterate through all controllers. For each controller, arrange the numbers of all data parts it is responsible for in ascending order. Determine the first data part whose number is greater than or equal to the identifier of the next data part that needs to be copied in the background. This data part is the one that each controller needs to copy.

[0142] Optionally, the source volume data can be divided into N data parts, including:

[0143] Divide the source volume data into multiple data blocks of equal size;

[0144] Based on the location of multiple data blocks in the source volume, the multiple data blocks are numbered in ascending order;

[0145] Take the remainder of the number corresponding to each data block with respect to the value of N;

[0146] Data blocks with the same remainder are grouped into a single data part, resulting in N data parts.

[0147] Optionally, the snapshot background synchronization device also includes:

[0148] The acquisition unit is used to acquire the background copy progress reported in real time by each controller during data synchronization;

[0149] The feedback unit is used to summarize the background copy progress feedback from all controllers, obtain the overall background copy progress, and then feed back the overall background copy progress to the user.

[0150] It should be noted that the snapshot background synchronization device provided in this embodiment of the invention can implement all the method steps implemented in the above snapshot background synchronization method embodiment and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.

[0151] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640. The processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a snapshot background synchronization method. This method includes: dividing the source volume data into N data parts, where N is a natural number greater than 1; evenly distributing the N data parts to the N controllers of the multi-controller storage system, so that each controller is responsible for synchronizing at least one data part; and synchronizing the data part handled by each controller to the target volume via a background copy method.

[0152] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0153] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the snapshot background synchronization method provided by the above methods. The method includes: dividing the source volume data into N data parts; where N is a natural number greater than 1; evenly distributing the N data parts to N controllers of a multi-controller storage system, such that each controller is responsible for synchronizing at least one data part; and synchronizing the data part responsible for each controller to the target volume through a background copy method.

[0154] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements the snapshot background synchronization method provided by the above methods. The method includes: dividing source volume data into N data parts; wherein N is a natural number greater than 1; distributing the N data parts evenly to N controllers of a multi-controller storage system, such that each controller is responsible for synchronizing at least one data part; and synchronizing the data part responsible for each controller to the target volume via background copy.

[0155] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0157] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for snapshot background synchronization, the method comprising: include: The source volume data is divided into N data parts; where N is a natural number greater than 1; the N data parts are numbered in ascending order according to their positions in the source volume data. The N data portions are evenly distributed among the N controllers of the multi-controller storage system using a distributed algorithm, so that each controller is responsible for synchronizing at least one data portion. According to the data portion number of each controller in ascending order, the data portion of each controller is synchronized to the target volume via background copying. The step of evenly distributing the N data portions to the N controllers of the multi-controller storage system includes: During initialization, a data section is allocated to each of the N controllers, with a one-to-one correspondence between the controller and the data section; If a faulty controller exists among the N controllers, the data portion handled by the faulty controller is reassigned to a target controller, which is any controller that handles the fewest data portions among the controllers that have not experienced a fault. The step of evenly distributing the N data portions to the N controllers of the multi-controller storage system further includes: After the fault controller returns to normal, the data portion that the fault controller was responsible for is redistributed to the fault controller. The step of synchronizing the data portion managed by each controller to the target volume via background copying includes: Repeat the following steps until the synchronization of the data portion handled by each controller is complete: If the background copy speed of the snapshot is detected to change from 0 to greater than 0, or if the data copy status indicator changes, the first data portion that has not been copied is determined based on the data copy status indicator. If it is determined that the first incomplete copy of the data portion exists, then the identifier of the next data portion that needs to be copied in the background is set to the number of the first incomplete copy of the data portion; Iterate through all controllers. For each controller, arrange the numbers of all data parts under its responsibility in ascending order. Determine the first data part whose number is greater than or equal to the identifier of the next data part to be copied in the background. This data part is then designated as the data part that each controller needs to copy. Notify each controller so that each controller can start its own background synchronization thread to synchronize the data part that needs to be copied to the target volume in the background. Upon receiving a copy completion notification message from the controller, update the bit position of the data portion corresponding to the copy completion notification message in the data portion copy status identifier; The data copy status identifier is used to indicate the copy status of the data portion managed by each controller, with each bit representing the copy status of a data portion. The identifier for the next data portion to be copied in the background is used to indicate the number of the next data portion to be copied in the background. The method further includes: Obtain the background copy progress reported in real time by each controller during data synchronization; The background copy progress feedback from all controllers is aggregated to obtain the overall background copy progress, which is then fed back to the user.

2. The snapshot background synchronization method of claim 1, wherein, The process of dividing the source volume data into N data parts includes: Divide the source volume data into multiple data blocks of equal size; Based on the location of the multiple data blocks in the source volume, the multiple data blocks are numbered in ascending order; Take the remainder of the number corresponding to each data block with respect to the value of N; Data blocks with the same remainder are grouped into a single data part, resulting in N data parts.

3. A snapshot background synchronization apparatus, characterized by comprising: include: A data partitioning unit is used to divide the source volume data into N data parts; where N is a natural number greater than 1; the N data parts are numbered in ascending order according to their positions in the source volume data; A data allocation unit is used to distribute the N data portions evenly to the N controllers of the multi-controller storage system using a distributed algorithm, so that each controller is responsible for the synchronization of at least one data portion. The data synchronization unit is used to synchronize the data portion managed by each controller to the target volume in ascending order of the data portion number managed by each controller through a background copy method. The step of evenly distributing the N data portions to the N controllers of the multi-controller storage system includes: During initialization, a data section is allocated to each of the N controllers, with a one-to-one correspondence between the controller and the data section; If a faulty controller exists among the N controllers, the data portion handled by the faulty controller is reassigned to a target controller, which is any controller that handles the fewest data portions among the controllers that have not experienced a fault. The step of evenly distributing the N data portions to the N controllers of the multi-controller storage system further includes: After the fault controller returns to normal, the data portion that the fault controller was responsible for is redistributed to the fault controller. The step of synchronizing the data portion managed by each controller to the target volume via background copying includes: Repeat the following steps until the synchronization of the data portion handled by each controller is complete: If the background copy speed of the snapshot is detected to change from 0 to greater than 0, or if the data copy status indicator changes, the first data portion that has not been copied is determined based on the data copy status indicator. If it is determined that the first incomplete copy of the data portion exists, then the identifier of the next data portion that needs to be copied in the background is set to the number of the first incomplete copy of the data portion; Iterate through all controllers. For each controller, arrange the numbers of all data parts under its responsibility in ascending order. Determine the first data part whose number is greater than or equal to the identifier of the next data part to be copied in the background. This data part is then designated as the data part that each controller needs to copy. Notify each controller so that each controller can start its own background synchronization thread to synchronize the data part that needs to be copied to the target volume in the background. Upon receiving a copy completion notification message from the controller, update the bit position of the data portion corresponding to the copy completion notification message in the data portion copy status identifier; The data copy status identifier is used to indicate the copy status of the data portion managed by each controller, with each bit representing the copy status of a data portion. The identifier for the next data portion to be copied in the background is used to indicate the number of the next data portion to be copied in the background. The device is also used for: Obtain the background copy progress reported in real time by each controller during data synchronization; The background copy progress feedback from all controllers is aggregated to obtain the overall background copy progress, which is then fed back to the user.

4. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the snapshot background synchronization method as described in any one of claims 1 to 2.

5. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by the processor, it implements the snapshot background synchronization method as described in any one of claims 1 to 2.