Read and write task execution method and device, storage medium and electronic device

By introducing a synchronization module in the RAID system, receiving the stripe number after the controller failure, and configuring the backup controller to generate synchronization tasks based on the configuration information, the service flow outage problem caused by data repair after the controller failure is solved, and the service is realized Continuity and efficiency.

CN118885134BActive Publication Date: 2025-02-07INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411372922.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-02-07
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

After the controller fails, the RAID card needs to complete the atomic verification update to repair the data before it can continue to process the host's service, resulting in the problem of traffic interruption.

Method used

By receiving the first band number sent by the first synchronization module of the first controller, after determining that the first controller has a fault, the second controller is configured according to its configuration information, and a first synchronization task is generated, and the scheduler is used to determine that the first controller has a fault. The second read and write task to be executed by the second controller in synchronization with the read and write path.

Benefits of technology

It realizes that the striping is no longer repaired when the controller fails, but is synchronized by the synchronization module during the host service processing process, avoiding service outage and improving system continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885134B_ABST
    Figure CN118885134B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a method and device for executing a read-write task, a storage medium, and an electronic device, wherein the method for executing a read-write task includes: receiving a first stripe number sent by a first synchronization module of a first controller, wherein the first stripe number is used to identify a stripe to be updated, the stripe to be updated is to execute a first read-write task, and the first read-write task is used by the first controller to write first data to the stripe to be updated; when it is determined that the first controller has failed, configuring the second controller according to the configuration information of the first controller, and generating a first synchronization task according to the first stripe number, wherein the configuration information is used by the second controller to generate the first synchronization task, and the first synchronization task is used to write the first data to the stripe to be updated; and synchronously executing the second read-write task and the first synchronization task to be executed by the second controller through a scheduler and a read-write path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a method and device for executing a read / write task, a storage medium, and an electronic device. Background Art

[0002] RAID technology originated from solving the problem of small capacity and high price of hard disks in early computer systems. By combining multiple small-capacity hard disks into a logical unit, RAID technology realizes large-capacity data storage and improves data security through data redundancy. With the continuous development of storage technology, RAID technology is also constantly evolving. From the initial RAID0 (data striping without redundancy) to RAID1 (disk mirroring), RAID5 (distributed parity check) and other levels, RAID technology provides different levels of data redundancy and performance optimization. The two main features of RAID technology are speed and security. Through methods such as data striping and parity check, RAID can provide higher storage performance and throughput than a single hard disk while ensuring data security.

[0003] In RAID5 and RAID6, data is divided into check blocks and check block data, which belong to different hard disks respectively. This results in the situation that if a controller fails when writing data, the data block is written but the check block is not written, or the check block is written but the data block is not written, and the check block and the data block cannot correspond. Now the correspondence between the two is guaranteed by the "atomic check update". Under this technology, when the controller fails, the stripe number of the redundant backup will be rewritten or reconstructed to repair the stripe, ensuring the correspondence between the check block and the data block.

[0004] The consistency of the stripe can be ensured by atomic check update, but it takes a certain amount of time to repair the data. However, in order to ensure the correctness of the data, this method cannot process the host business. The host business can only be processed after the atomic check update is completed to repair the data; this affects the continuity of the business and often causes a flow interruption time of seconds.

[0005] In the related art, after a controller failure, the RAID card needs to complete atomic check update to repair the data before it can continue to process the host's business, resulting in a technical problem of business interruption. No effective solution has yet been proposed. Summary of the invention

[0006] The embodiments of the present application provide a method and device for executing read and write tasks, a storage medium and an electronic device, so as to at least solve the problem in the related art that, after a controller failure, the RAID card needs to complete an atomic check update to repair the data before it can continue to process the host's business, resulting in business interruption.

[0007] According to an embodiment of the present application, a method for executing a read-write task is provided, comprising: receiving a first stripe number sent by a first synchronization module of a first controller, wherein the first stripe number is used to identify a stripe to be updated, the stripe to be updated is to execute a first read-write task, and the first read-write task is used by the first controller to write first data to the stripe to be updated; in the case of determining that the first controller has failed, configuring the second controller according to the configuration information of the first controller, and generating a first synchronization task according to the first stripe number, wherein the configuration information is used by the second controller to generate the first synchronization task, and the first synchronization task is used to write the first data to the stripe to be updated; and synchronously executing a second read-write task to be executed by the second controller and the first synchronization task through a scheduler and a read-write path.

[0008] In an exemplary embodiment, before configuring the second controller according to the configuration information of the first controller and generating the first synchronization task according to the first stripe number, the method also includes: when it is determined that the first controller has failed, switching the second controller to a silent state; when it is determined that the second controller is in the silent state, executing a third read-write task received by the second controller through the read-write path; when it is determined that the third read-write task is completed, switching the second controller to a ready state.

[0009] In an exemplary embodiment, configuring the second controller according to the configuration information of the first controller and generating the first synchronization task according to the first stripe number includes: obtaining the configuration information from the first controller when determining that the second controller is in the ready state; obtaining the first stripe number from the power-off protection memory of the second controller, and generating the first synchronization task according to the configuration information and the first stripe number; and sending the first synchronization task to the scheduler to instruct the scheduler to execute the first synchronization task.

[0010] In an exemplary embodiment, after configuring the second controller according to the configuration information of the first controller and generating the first synchronization task according to the first stripe number, the method also includes: switching the second controller to a running state; when determining that the second controller is in the running state, receiving the second read and write task sent by the host; executing the first synchronization task through the scheduler and the read and write path, and executing the second read and write task through the read and write path.

[0011] In an exemplary embodiment, executing the second read-write task through the read-write path includes: determining the second stripe number of the first stripe corresponding to the second read-write task; matching the second stripe number in the power-off protection memory of the second controller; and executing the second read-write task through the read-write path if the second stripe number matching fails.

[0012] In an exemplary embodiment, after matching the second stripe number in the power-off protection memory of the second controller, the method further includes: generating a second synchronization task based on the second stripe number when the second stripe number is matched successfully; sending the second synchronization task to the scheduler to instruct the scheduler to execute the second synchronization task; and executing the second read and write task through the read and write path when it is determined that the second synchronization task has been completed.

[0013] In an exemplary embodiment, the method also includes: in the process of executing the target synchronization task through the scheduler, registering an exclusive lock in the read-write path according to the third stripe number of the target synchronization task, wherein the exclusive lock is used to indicate that the second stripe corresponding to the third stripe number is prohibited from executing read-write tasks, wherein the target synchronization task includes: the first synchronization task, the second synchronization task; when it is determined that the execution of the target synchronization task is completed, canceling the exclusive lock in the read-write path.

[0014] In an exemplary embodiment, the method also includes: when it is determined that the target synchronization task is executed, deleting the third stripe number from the power-off protection memory of the third controller through the second synchronization module of the second controller, wherein the third controller is a controller that has not failed and the third controller includes the second controller.

[0015] In an exemplary embodiment, before executing the first synchronization task through the scheduler and the read-write path, the method also includes: obtaining a write success message of the first read-write task from the host, wherein the write success message is used to indicate that the first controller has successfully written the first data block of the first data into the stripe to be updated; if the write success message is not obtained, generating the first synchronization task according to the second data, so as to reconstruct the check block stored in the stripe to be updated into the second check block of the second data through the first synchronization task, and instructing the host to generate the second read-write task according to the first data, wherein the second data is the data stored before the stripe to be updated executes the first read-write task; if the write success message is obtained, generating the first synchronization task according to the first data, so as to reconstruct the check block stored in the stripe to be updated into the first check block of the first data through the first synchronization task.

[0016] In an exemplary embodiment, generating a first synchronization task based on the first stripe number includes: receiving an acquisition request sent by the scheduler, wherein the acquisition request is triggered by a timer in the scheduler; responding to the acquisition request, reading a first stripe number from the power-off protection memory of the second controller, and generating a first synchronization task.

[0017] In an exemplary embodiment, after synchronously executing the second read-write task to be executed by the second controller and the first synchronization task through the scheduler and the read-write path, the method also includes: receiving a copy request from the first controller, wherein the copy request is used to indicate that the first controller fault is repaired, and the copy request is used to copy the fourth stripe number in the power-off protection memory of the second controller, wherein the first stripe number includes the fourth stripe number; switching the second controller to the silent state, and executing the fourth read-write task received by the second controller through the read-write path; when determining that the fourth read-write task is completed, responding to the copy request, sending the fourth stripe number to the first controller; switching the second controller to the running state, and executing the fifth read-write task sent by the host through the read-write path.

[0018] According to another embodiment of the present application, a device for executing a read-write task is provided, including: a receiving module, used to receive a first stripe number sent by a first synchronization module of a first controller, wherein the first stripe number is used to identify a stripe to be updated, the stripe to be updated is to execute a first read-write task, and the first read-write task is used by the first controller to write first data to the stripe to be updated; a generating module, used to configure the second controller according to the configuration information of the first controller when it is determined that the first controller has failed, and to generate a first synchronization task according to the first stripe number, wherein the configuration information is used by the second controller to generate the first synchronization task, and the first synchronization task is used to write the first data to the stripe to be updated; an executing module, used to synchronously execute the second read-write task to be executed by the second controller and the first synchronization task through a scheduler and a read-write path.

[0019] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0020] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0021] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.

[0022] Through the present application, a first stripe number sent by a first synchronization module of a first controller is received, wherein the first stripe number is used to identify a stripe to be updated on which a first read-write task is to be executed, and the first read-write task is used by the first controller to write first data into the stripe to be updated; if it is determined that the first controller fails, the second controller is configured according to the configuration information of the first controller, and a first synchronization task is generated according to the first stripe number, wherein the configuration information is used to generate the first synchronization task, and the first synchronization task is used to write the first data into the stripe to be updated; finally, the second read-write task and the first synchronization task to be executed by the second controller are synchronously executed through the scheduler and the read-write path; by adopting the above scheme, the stripes to be repaired are uniformly managed through the newly added synchronization module, and when the controller fails, the stripes are no longer repaired, but are synchronously repaired by the synchronization module during the host business processing process, so as to realize the uninterrupted flow of the controller failure; thereby solving the problem in the related art that after the controller fails, the RAID card needs to complete the atomic check update to repair the data before it can continue to process the host business, resulting in business interruption. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 It is a hardware structure block diagram of a computer terminal according to a method for executing a read-write task in an embodiment of the present application;

[0024] Figure 2 is a flowchart of a method for executing a read-write task according to an embodiment of the present application;

[0025] Figure 3 is a flowchart of an optional method for executing a read-write task according to an embodiment of the present application;

[0026] Figure 4 It is a flowchart of an optional stripe number backup method according to an embodiment of the present application;

[0027] Figure 5 is a flowchart of an optional task execution method according to an embodiment of the present application;

[0028] Figure 6 It is a structural block diagram of a device for executing read and write tasks according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0031] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a computer terminal for sending a data exchange request according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0032] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for sending a data exchange request in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0033] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0034] The following is an explanation of the professional terms that appear in this application:

[0035] NGN, Next Generation Network, next generation network.

[0036] In the related art, an atomic check update method is proposed to ensure the correspondence between the check block and the data block. The method specifically includes the following steps:

[0037] Step 1.1: Before writing the data block and the check block to the disk, the stripe number to be updated is stored in the power-off protected memory and a controller redundancy backup is performed;

[0038] Step 1.2: The controller that writes the data will also back up the data to the power-off protected memory, but this data is often not copied to the redundant controller;

[0039] Step 1.3: After the data is written successfully, the stripe number and the backed-up data are deleted from each redundant backup controller.

[0040] Under this technology, when a controller fails, the stripe will be repaired by rewriting or reconstructing the redundant backup stripe number to ensure the correspondence between the check block and the data block. Specifically, after a controller fails, the backup stripe number is updated through atomic check to read that some stripe numbers have not completed the writing of data blocks or check blocks; for controllers with data backup, the backup data is flushed to the disk; and for stripes without data backup, the check data is reconstructed to the disk through reconstruction.

[0041] This method can ensure the consistency of the stripe, but it takes a certain amount of time to repair the data. The reason is that in order to ensure the correctness of the data, the host business cannot be processed. The atomic check update must be completed to repair the data before the host business can continue to be processed; thus affecting the continuity of the business, often resulting in interruption time of seconds.

[0042] In order to solve the above problems, a method for executing a read-write task is provided in this embodiment. Figure 2 is a flowchart of a method for executing a read / write task according to an embodiment of the present application, such as Figure 2 As shown, the method includes:

[0043] Step S202, receiving a first stripe number sent by a first synchronization module of a first controller, wherein the first stripe number is used to identify a stripe to be updated, the stripe to be updated is to execute a first read / write task, and the first read / write task is used by the first controller to write first data into the stripe to be updated;

[0044] Step S204: when it is determined that the first controller fails, configure the second controller according to the configuration information of the first controller, and generate a first synchronization task according to the first stripe number, wherein the configuration information is used by the second controller to generate the first synchronization task, and the first synchronization task is used to write the first data into the stripe to be updated;

[0045] Step S206: Synchronously executing the second read-write task to be executed by the second controller and the first synchronization task through the scheduler and the read-write path.

[0046] Through the above steps, the first stripe number sent by the first synchronization module of the first controller is received, wherein the first stripe number is used to identify the stripe to be updated for executing the first read-write task, and the first read-write task is used by the first controller to write the first data into the stripe to be updated; if it is determined that the first controller fails, the second controller is configured according to the configuration information of the first controller, and the first synchronization task is generated according to the first stripe number, wherein the configuration information is used to generate the first synchronization task, and the first synchronization task is used to write the first data into the stripe to be updated; finally, the second read-write task and the first synchronization task to be executed by the second controller are synchronously executed through the scheduler and the read-write path; by adopting the above scheme, the stripes to be repaired are uniformly managed through the newly added synchronization module, and when the controller fails, the stripes are no longer repaired, but the synchronization module performs the repair synchronously during the host business processing, so as to realize the controller failure and uninterrupted flow; thereby solving the problem in the related art that after the controller fails, the RAID card needs to complete the atomic check update to repair the data before continuing to process the host business, resulting in business interruption.

[0047] In an exemplary embodiment, before configuring the second controller according to the configuration information of the first controller and generating the first synchronization task according to the first stripe number, the method also includes: when it is determined that the first controller has failed, switching the second controller to a silent state; when it is determined that the second controller is in the silent state, executing a third read-write task received by the second controller through the read-write path; when it is determined that the third read-write task is completed, switching the second controller to a ready state.

[0048] When controller 1 (i.e., the first controller mentioned above) fails, controller 2 (i.e., the second controller mentioned above) will take over the business of controller 1 for processing. However, before officially taking over the business of controller 1, controller 2 needs to first complete the read and write tasks (i.e., the third read and write tasks) sent by the host received by itself. Therefore, controller 2 switches to the silent state, first completes the processing of the unprocessed IO (i.e., the third read and write task), and then enters the preparation stage.

[0049] In this embodiment, before controller 2 takes over the tasks of controller 1, it first clears its own tasks to be executed, thereby ensuring that this part of the tasks is carried out in an orderly manner.

[0050] Furthermore, the second controller is configured according to the configuration information of the first controller, and the first synchronization task is generated according to the first stripe number, including: when it is determined that the second controller is in the ready state, obtaining the configuration information from the first controller; obtaining the first stripe number from the power-off protection memory of the second controller, and generating the first synchronization task according to the configuration information and the first stripe number; and sending the first synchronization task to the scheduler to instruct the scheduler to execute the first synchronization task.

[0051] When controller 2 is in the preparation stage, it will obtain the configuration information corresponding to controller 1 from the first controller, and obtain the first stripe number from the power-off protection memory of the second controller, and then prepare the structure required by the scheduler according to the configuration information, and update the stripe number that needs to be synchronized (that is, the above-mentioned first stripe number) to the scheduler, thereby completing the issuance of the first synchronization task.

[0052] Through this embodiment, after controller 2 is ready, the stripe number to be synchronized is updated to the scheduler according to the specified data format, and the scheduler completes the repair synchronization work of the corresponding stripe, so that the stripe synchronization work can be successfully completed without affecting the host business of controller 2.

[0053] Furthermore, after configuring the second controller according to the configuration information of the first controller and generating the first synchronization task according to the first stripe number, the method also includes: switching the second controller to a running state; when determining that the second controller is in the running state, receiving the second read and write task sent by the host; executing the first synchronization task through the scheduler and the read and write path, and executing the second read and write task through the read and write path.

[0054] After the controller 2 completes the corresponding preparation work, it can switch back to the running state. In this state, it can receive the second read and write task newly issued by the host to ensure the smooth completion of the controller 2's main work; then the first synchronization task and the second read and write task are completed synchronously through multi-threading to ensure the uninterrupted flow of the host business.

[0055] Optionally, executing the second read-write task through the read-write path includes: determining the second stripe number of the first stripe corresponding to the second read-write task; matching the second stripe number in the power-off protection memory of the second controller; and executing the second read-write task through the read-write path if the second stripe number matching fails.

[0056] When controller 2 needs to write data of a stripe, it first reads from the power-off protection memory to confirm whether the stripe needs to be synchronized. If synchronization is not required, the read and write operations corresponding to the second read and write task can be directly executed through the IO path (i.e. the above read and write path).

[0057] Through this embodiment, when controller 2 assists controller 1 in completing stripe repair work, it first confirms whether the corresponding stripe needs to be repaired and whether the repair has been completed before executing the read and write tasks, so as to avoid data disorder caused by executing read and write tasks on the unrepaired stripe.

[0058] Optionally, after matching the second stripe number in the power-off protection memory of the second controller, the method further includes: generating a second synchronization task based on the second stripe number when the second stripe number is matched successfully; sending the second synchronization task to the scheduler to instruct the scheduler to execute the second synchronization task; and executing the second read and write task through the read and write path when it is determined that the second synchronization task has been completed.

[0059] If the second stripe number matches successfully, it is determined that the stripe needs to be synchronized. Before executing the second read-write task, the stripe repair work needs to be completed first. Therefore, the second synchronization task is first generated according to the second stripe number and sent to the scheduler. The stripe repair work is completed through the scheduler. After determining that the stripe repair is completed, the second read-write task is executed through the read-write path.

[0060] Through this embodiment, the correctness of the corresponding stripe is ensured before executing the read and write tasks, thereby ensuring that the stripe can correctly complete the read and write work.

[0061] Optionally, the method also includes: in the process of executing the target synchronization task through the scheduler, registering an exclusive lock in the read-write path according to the third stripe number of the target synchronization task, wherein the exclusive lock is used to indicate that the second stripe corresponding to the third stripe number is prohibited from executing read-write tasks, wherein the target synchronization task includes: the first synchronization task, the second synchronization task; when it is determined that the execution of the target synchronization task is completed, canceling the exclusive lock in the read-write path.

[0062] The controller controls the mutually exclusive relationship between read and write operations and synchronization operations on the controller through an exclusive lock. When the synchronization operation is performed, the exclusive lock registered to the IO Path is required, and no read and write operations will be performed at this time. The exclusive lock is used to ensure that only one controller can read, write or synchronize a specific data strip at the same time to avoid data inconsistency and conflict. Specifically, the exclusive lock is used in the following situations:

[0063] 1. During synchronization: When the synchronization module needs to reconstruct or update a data stripe to ensure the consistency of the data block and the check block, it will acquire the exclusive lock. While the lock is held, other controllers cannot perform task read and write operations on this stripe, ensuring the integrity of the data during the reconstruction process.

[0064] 2. When writing data: When the controller writes data to the disk, if the stripe is marked as requiring synchronization, the controller checks and acquires an exclusive lock to ensure that no other synchronization operations occur during the writing process to prevent data conflicts.

[0065] 3. When the controller fails and recovers: After the controller 1 fails and recovers, in order to synchronize the status with the controller 2, the controller 1 will copy the data in the power-off protection memory of the controller 2. During this process, the controller 2 needs to be silent and obtain an exclusive lock to ensure that no data read, write or synchronization operations occur during the copy process to avoid data confusion.

[0066] In this embodiment, by using exclusive locks, the system can effectively manage data writing and synchronization operations in a multi-controller environment, ensure data consistency and security, while minimizing interference with business processing, and achieve more efficient and stable operation.

[0067] In an optional embodiment, an optional method for executing a read-write task is proposed, such as Figure 3 As shown, the method includes the following processes:

[0068] Step 3.1, when controller 2 needs to write data of a certain stripe (i.e., when executing the second read / write task), first read the stripe from the power-off protection memory to see whether synchronization is required. If synchronization is required, synchronize the data by reconstruction;

[0069] Step 3.2: Wait for the reconstruction to be completed, delete the information that needs to be synchronized for the stripe, and update the flag of whether synchronization is required in all controllers, because this information must be consistent on all surviving controllers;

[0070] Step 3.3, check whether there is information about this strip in the scheduler. If so, delete the information about this strip in the scheduler and obtain the strip number of the new strip that needs to be synchronized to the scheduler;

[0071] Step 3.4, perform read or write operations;

[0072] Step 3.5: The controller controls the mutually exclusive relationship between read and write operations and synchronization operations on the controller through an exclusive lock. When the synchronization operation is performed, it needs to be registered with the exclusive lock of the IO Path. At this time, no read and write operations will be performed.

[0073] Optionally, the method also includes: when it is determined that the target synchronization task is executed, deleting the third stripe number from the power-off protection memory of the third controller through the second synchronization module of the second controller, wherein the third controller is a controller that has not failed and the third controller includes the second controller.

[0074] After any synchronization task is completed, the stripe number corresponding to the synchronization task is deleted from the power-off protection memory, and the information of all surviving controllers, that is, the third controller mentioned above, is synchronized through the synchronization module. Optionally, it is also possible to further check whether there is still information of the stripe in the scheduler, and if so, update it; thereby ensuring the timely update and correctness of the information.

[0075] Optionally, before executing the first synchronization task through the scheduler and the read-write path, the method also includes: obtaining a write success message of the first read-write task from the host, wherein the write success message is used to indicate that the first controller has successfully written the first data block of the first data into the strip to be updated; if the write success message is not obtained, generating the first synchronization task according to the second data, so as to reconstruct the check block stored in the strip to be updated into the second check block of the second data through the first synchronization task, and instructing the host to generate the second read-write task according to the first data, wherein the second data is the data stored in the strip to be updated before the first read-write task is executed; if the write success message is obtained, generating the first synchronization task according to the first data, so as to reconstruct the check block stored in the strip to be updated into the first check block of the first data through the first synchronization task.

[0076] In this application, as long as the data is written successfully, the write success can be returned to the host, without waiting for the check block to be written successfully, reducing the delay of data writing. Before the data is written, the redundant backup of the stripe in the two controllers is required to be out of sync. When the data block is written successfully, the write success can be returned to the host.

[0077] The following two situations are discussed:

[0078] 1. When the data block is written successfully (i.e., a write success message is obtained), and the controller fails before the check block is written, the redundant controller 2 updates the check block by reconstruction, i.e., generates and executes the first synchronization task according to the first check block of the first data, to ensure that the data block is consistent with the check block;

[0079] 2. When the data block is not written successfully (that is, the write success message is not obtained), since the controller does not know whether the check block is written successfully, regardless of whether the check block is written successfully, the check block needs to be reconstructed and the check block is refreshed with the old data (that is, the second check block mentioned above). Then the host multipath senses the path failure and retries from the redundant controller, re-initiates the read and write task (that is, the second read and write task mentioned above) and re-writes the new data.

[0080] Through this embodiment, when the data block is written successfully, the check block is updated to ensure the consistency of the two; when the data block is not written successfully, the check block is refreshed to the old data, and the read and write tasks are regenerated and issued to complete the correct writing of the corresponding data.

[0081] In an exemplary embodiment, generating a first synchronization task based on the first stripe number includes: receiving an acquisition request sent by the scheduler, wherein the acquisition request is triggered by a timer in the scheduler; responding to the acquisition request, reading a first stripe number from the power-off protection memory of the second controller, and generating a first synchronization task.

[0082] The scheduler is triggered by a timer to obtain the stripe number of the unrepaired stripe. The timer periodically reads the stripes that need to be synchronized in the power-off protection memory and records them in the scheduler. The scheduler sends it to the IO Path as a special write operation (that is, a synchronization task) for processing.

[0083] Through this embodiment, the stripe number is obtained regularly and quantitatively through a timer, thereby ensuring the orderly delivery of synchronization tasks.

[0084] Based on the above steps, after synchronously executing the second read-write task to be executed by the second controller and the first synchronization task through the scheduler and the read-write path, the method also includes: receiving a copy request from the first controller, wherein the copy request is used to indicate that the first controller fault is repaired, and the copy request is used to copy the fourth stripe number in the power-off protection memory of the second controller, wherein the first stripe number includes the fourth stripe number; switching the second controller to the silent state, and executing the fourth read-write task received by the second controller through the read-write path; when determining that the fourth read-write task is completed, responding to the copy request, sending the fourth stripe number to the first controller; switching the second controller to the running state, and executing the fifth read-write task sent by the host through the read-write path.

[0085] After controller 1 is restored, controller 2 starts to be silent and completes the unfinished IO processing (i.e., the fourth read and write task mentioned above); while waiting for controller 2 to complete being silent, controller 1 copies the power-off protection memory of controller 2 to its own power-off protection memory, and after waiting for the copy to be completed, controller 1 is updated with the new configuration information and enters the preparation stage. Then, controller 1 prepares the structure required by the scheduler, updates the stripes that need to be synchronized to the scheduler, and controller 1 completes the unfinished stripe repair work; finally, controllers 1 and 2 enter the operation stage and begin to process host services normally.

[0086] Through this embodiment, after the controller 1 returns to normal, it takes over the corresponding work again, and at the same time, the synchronous execution of the post-synchronization task and the read-write task is completed by the scheduler, so that no business interruption occurs.

[0087] Optionally, the present application embodiment provides an optional stripe number backup method, the process of which is as follows: Figure 4 As shown, the following steps are included:

[0088] Step 4.1, controller 1 sends the read / write task (i.e., the first read / write task) issued by the host to the RAID IOPath (i.e., the read / write path);

[0089] Step 4.2: before the data block and the check block are written to the disk, the stripe number to be updated (i.e., the first stripe number) is registered in the Sync module (i.e., the first control module);

[0090] Step 4.3, the synchronization module performs redundant backup between controllers and backs up to the synchronization module (ie, the second synchronization module) of other controllers (such as controller 2);

[0091] Step 4.4, the read-write path writes the data to the disk;

[0092] Step 4.5, delete the stripe number from the synchronization module;

[0093] Step 4.6: The synchronization module synchronizes information with the synchronization modules of other controllers, and deletes the strip number.

[0094] Through this embodiment, the newly added synchronization module is used to uniformly manage the stripes that need to be repaired, thereby ensuring that the stripe repair work is carried out in an orderly manner.

[0095] In an optional embodiment, the present application provides an optional task execution method, the process is as follows: Figure 5 As shown, the following steps are included:

[0096] On the one hand, the task execution method completes the execution of the synchronization task through the following steps 5.1-5.4:

[0097] Step 5.1, the synchronization module adds the stripe number to the power-off protection memory;

[0098] Step 5.2, the scheduler reads the stripe number from the power-off protection memory;

[0099] Step 5.3: The scheduler generates a synchronization task based on the stripe number and sends it to the IO Path (read-write path).

[0100] Step 5.4: The read-write path executes the synchronization task, and after the execution is completed, the stripe number is deleted from the power-off protection memory.

[0101] On the other hand, the task execution method completes the execution of the read and write tasks through the following steps 5.5-5.8:

[0102] Step 5.5: When controller 2 needs to write data of a certain stripe, that is, when it receives a read / write task sent by the host, it first confirms from the power-off protection memory whether the stripe needs to be synchronized, and updates the flag of whether synchronization is needed;

[0103] Step 5.6: If synchronization is required, synchronize the data by reconstruction (i.e., execute the above synchronization task);

[0104] Step 5.7: Wait for the reconstruction to be completed, delete the information that needs to be synchronized for the stripe, update the flag that indicates whether synchronization is required, and ensure that the information is consistent on all surviving controllers;

[0105] Step 5.8: Check whether there is information about this strip in the scheduler. If so, delete the information about this strip in the scheduler and obtain the new strip number that needs to be synchronized to the scheduler.

[0106] Through the above embodiments, there is no need to write data into the power-off protection memory, which can reduce the memory cost and shorten the write operation delay.

[0107] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0108] In this embodiment, a device for executing a read-write task is also provided. Figure 6 is a structural block diagram of a device for executing a read / write task according to an embodiment of the present application, such as Figure 6 As shown, the device comprises:

[0109] A receiving module 62, configured to receive a first stripe number sent by a first synchronization module of a first controller, wherein the first stripe number is used to identify a stripe to be updated, the stripe to be updated is to execute a first read / write task, and the first read / write task is used by the first controller to write first data into the stripe to be updated;

[0110] A generating module 64 is used for, when it is determined that the first controller fails, configuring the second controller according to the configuration information of the first controller, and generating a first synchronization task according to the first stripe number, wherein the configuration information is used for the second controller to generate the first synchronization task, and the first synchronization task is used to write the first data into the stripe to be updated;

[0111] The execution module 66 is used to synchronously execute the second read-write task to be executed by the second controller and the first synchronization task through a scheduler and a read-write path.

[0112] Through the above-mentioned device, a first stripe number sent by a first synchronization module of the first controller is received, wherein the first stripe number is used to identify the stripe to be updated on which the first read-write task is to be executed, and the first read-write task is used by the first controller to write the first data into the stripe to be updated; if it is determined that the first controller fails, the second controller is configured according to the configuration information of the first controller, and a first synchronization task is generated according to the first stripe number, wherein the configuration information is used to generate the first synchronization task, and the first synchronization task is used to write the first data into the stripe to be updated; finally, the second read-write task and the first synchronization task to be executed by the second controller are synchronously executed through the scheduler and the read-write path; by adopting the above-mentioned scheme, the stripes to be repaired are uniformly managed through the newly added synchronization module, and when the controller fails, the stripes are no longer repaired, but are synchronously repaired by the synchronization module during the host business processing process, so as to realize the uninterrupted flow of the controller failure; thereby solving the problem in the related art that after the controller fails, the RAID card needs to complete the atomic check update to repair the data before it can continue to process the host business, resulting in the interruption of the business.

[0113] Optionally, the above-mentioned generation module 64 is also used to switch the second controller to a silent state when it is determined that the first controller fails; when it is determined that the second controller is in the silent state, execute the third read and write task received by the second controller through the read and write path; when it is determined that the third read and write task is completed, switch the second controller to a ready state.

[0114] Optionally, the above-mentioned generation module 64 is also used to obtain the configuration information from the first controller when it is determined that the second controller is in the ready state; obtain the first stripe number from the power-off protection memory of the second controller, and generate the first synchronization task based on the configuration information and the first stripe number; and send the first synchronization task to the scheduler to instruct the scheduler to execute the first synchronization task.

[0115] Furthermore, the above-mentioned generation module 64 is also used to switch the second controller to an operating state; when it is determined that the second controller is in the operating state, receive the second read-write task sent by the host; execute the first synchronization task through the scheduler and the read-write path, and execute the second read-write task through the read-write path.

[0116] Optionally, the above-mentioned execution module 66 is also used to determine the second stripe number of the first stripe corresponding to the second read and write task; match the second stripe number in the power-off protection memory of the second controller; and if the second stripe number matching fails, execute the second read and write task through the read and write path.

[0117] Optionally, the above-mentioned execution module 66 is also used to generate a second synchronization task according to the second stripe number when the second stripe number matches successfully; send the second synchronization task to the scheduler to instruct the scheduler to execute the second synchronization task; and execute the second read and write task through the read and write path when it is determined that the second synchronization task is completed.

[0118] Optionally, the above-mentioned device is also used to register an exclusive lock in the read-write path according to the third stripe number of the target synchronization task during the process of executing the target synchronization task through the scheduler, wherein the exclusive lock is used to indicate that the second stripe corresponding to the third stripe number is prohibited from executing read-write tasks, wherein the target synchronization task includes: the first synchronization task, the second synchronization task; when it is determined that the execution of the target synchronization task is completed, the exclusive lock in the read-write path is cancelled.

[0119] Optionally, the above-mentioned device is also used to delete the third stripe number from the power-off protection memory of the third controller through the second synchronization module of the second controller when it is determined that the target synchronization task is completed, wherein the third controller is a controller that has not failed and the third controller includes the second controller.

[0120] Optionally, the above-mentioned execution module 66 is also used to obtain a write success message of the first read-write task from the host, wherein the write success message is used to indicate that the first controller has successfully written the first data block of the first data into the strip to be updated; if the write success message is not obtained, the first synchronization task is generated according to the second data, so as to reconstruct the check block stored in the strip to be updated into the second check block of the second data through the first synchronization task, and instruct the host to generate the second read-write task according to the first data, wherein the second data is the data stored before the strip to be updated executes the first read-write task; if the write success message is obtained, the first synchronization task is generated according to the first data, so as to reconstruct the check block stored in the strip to be updated into the first check block of the first data through the first synchronization task.

[0121] Optionally, the above-mentioned generation module 64 is also used to receive an acquisition request sent by the scheduler, wherein the acquisition request is triggered by a timer in the scheduler; in response to the acquisition request, a first stripe number is read from the power-off protection memory of the second controller, and a first synchronization task is generated.

[0122] Optionally, the above-mentioned execution module 66 is also used to receive a copy request from the first controller, wherein the copy request is used to indicate that the first controller fault is repaired, and the copy request is used to copy the fourth stripe number in the power-off protection memory of the second controller, wherein the first stripe number includes the fourth stripe number; switch the second controller to the silent state, and execute the fourth read-write task received by the second controller through the read-write path; when it is determined that the fourth read-write task is completed, respond to the copy request and send the fourth stripe number to the first controller; switch the second controller to the running state, and execute the fifth read-write task sent by the host through the read-write path.

[0123] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0124] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0125] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0126] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0127] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0128] An embodiment of the present application further provides a computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program product, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.

[0129] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0130] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0131] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for executing a read-write task, characterized in that: include: Receive a first stripe number sent by a first synchronization module of a first controller, wherein the first stripe number is used to identify a stripe to be updated, the stripe to be updated is to execute a first read / write task, and the first read / write task is used by the first controller to write first data into the stripe to be updated; In the case where it is determined that the first controller fails, the second controller is configured according to the configuration information of the first controller, and a first synchronization task is generated according to the first stripe number, wherein the configuration information is used by the second controller to generate the first synchronization task, and the first synchronization task is used to write the first data into the stripe to be updated; Synchronously executing the second read-write task to be executed by the second controller and the first synchronization task through the scheduler and the read-write path; Before configuring the second controller according to the configuration information of the first controller and generating the first synchronization task according to the first stripe number, the method further includes: If it is determined that the first controller fails, switching the second controller to a silent state; When it is determined that the second controller is in the silent state, executing the third read / write task received by the second controller through the read / write path; When it is determined that the third read / write task is completed, the second controller is switched to a ready state.

2. The method for executing a read-write task according to claim 1, characterized in that: The configuring the second controller according to the configuration information of the first controller and generating a first synchronization task according to the first stripe number includes: When determining that the second controller is in the ready state, acquiring the configuration information from the first controller; Acquire the first stripe number from the power-off protection memory of the second controller, and generate the first synchronization task according to the configuration information and the first stripe number; The first synchronization task is sent to the scheduler to instruct the scheduler to execute the first synchronization task.

3. The method for executing a read-write task according to claim 1, characterized in that: After configuring the second controller according to the configuration information of the first controller and generating the first synchronization task according to the first stripe number, the method further includes: Switching the second controller to a running state; When determining that the second controller is in the running state, receiving the second read-write task sent by the host; The first synchronization task is executed through the scheduler and the read-write path, and the second read-write task is executed through the read-write path.

4. The method for executing a read-write task according to claim 3, characterized in that: The performing the second read-write task through the read-write path includes: Determine a second stripe number of the first stripe corresponding to the second read / write task; matching the second stripe number in a power-off protection memory of the second controller; In the case where the second stripe number matching fails, the second read-write task is executed through the read-write path.

5. The method for executing a read-write task according to claim 4, characterized in that: After matching the second stripe number in the power-off protection memory of the second controller, the method further includes: If the second stripe number matches successfully, generating a second synchronization task according to the second stripe number; Sending the second synchronization task to the scheduler to instruct the scheduler to execute the second synchronization task; When it is determined that the second synchronization task is completed, the second read-write task is executed through the read-write path.

6. The method for executing a read-write task according to any one of claims 1 to 5, characterized in that: The method further comprises: In the process of executing the target synchronization task through the scheduler, an exclusive lock is registered in the read-write path according to the third stripe number of the target synchronization task, wherein the exclusive lock is used to indicate that the second stripe corresponding to the third stripe number is prohibited from executing the read-write task, wherein the target synchronization task includes: the first synchronization task, the second synchronization task; When it is determined that the target synchronization task is completed, the exclusive lock is cancelled in the read-write path.

7. The method for executing a read-write task according to claim 6, characterized in that: The method further comprises: When it is determined that the target synchronization task is completed, the third stripe number is deleted from the power-off protection memory of the third controller through the second synchronization module of the second controller, wherein the third controller is a controller that has not failed and the third controller includes the second controller.

8. The method for executing a read-write task according to claim 3, characterized in that: Before executing the first synchronization task through the scheduler and the read-write path, the method further includes: Obtaining a write success message of the first read / write task from the host, wherein the write success message is used to indicate that the first controller has successfully written the first data block of the first data into the stripe to be updated; In the case where the write success message is not obtained, the first synchronization task is generated according to the second data, so as to reconstruct the check block stored in the stripe to be updated into the second check block of the second data through the first synchronization task, and instruct the host to generate the second read-write task according to the first data, wherein the second data is the data stored in the stripe to be updated before the first read-write task is executed; When the write success message is obtained, the first synchronization task is generated according to the first data, so as to reconstruct the check block stored in the to-be-updated stripe into the first check block of the first data through the first synchronization task.

9. The method for executing a read-write task according to claim 1, characterized in that: Generating a first synchronization task according to the first stripe number includes: Receiving an acquisition request sent by the scheduler, wherein the acquisition request is triggered by a timer in the scheduler; In response to the acquisition request, a first stripe number is read from the power-off protection memory of the second controller, and a first synchronization task is generated.

10. The method for executing a read-write task according to claim 3, characterized in that: After synchronously executing the second read-write task to be executed by the second controller and the first synchronization task through the scheduler and the read-write path, the method further includes: receiving a copy request from the first controller, wherein the copy request is used to indicate that the first controller is repaired, and the copy request is used to copy a fourth stripe number in a power-off protection memory of the second controller, wherein the first stripe number includes the fourth stripe number; Switching the second controller to the silent state, and executing the fourth read-write task received by the second controller through the read-write path; When it is determined that the fourth read / write task is completed, responding to the copy request, sending the fourth stripe number to the first controller; The second controller is switched to the running state, and the fifth read-write task sent by the host is executed through the read-write path.

11. A device for executing a read-write task, characterized in that: include: A receiving module, configured to receive a first stripe number sent by a first synchronization module of a first controller, wherein the first stripe number is used to identify a stripe to be updated, the stripe to be updated is to execute a first read / write task, and the first read / write task is used by the first controller to write first data into the stripe to be updated; a generating module, configured to configure the second controller according to the configuration information of the first controller and generate a first synchronization task according to the first stripe number when it is determined that the first controller fails, wherein the configuration information is used by the second controller to generate the first synchronization task, and the first synchronization task is used to write the first data into the stripe to be updated; An execution module, used for synchronously executing the second read-write task to be executed by the second controller and the first synchronization task through a scheduler and a read-write path; Among them, the generation module is also used to switch the second controller to a silent state when it is determined that the first controller fails; when it is determined that the second controller is in the silent state, execute the third read and write task received by the second controller through the read and write path; when it is determined that the third read and write task is completed, switch the second controller to a ready state.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 10 when executed by a processor.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Resource access method and device

    CN105677519A