Disk array partial reconstruction methods, apparatus, electronic devices and storage media
By obtaining the reconstruction information table in the SMR redundant array and performing header stripe data consistency verification, the data inconsistency problem caused by the write pointer position not being updated in the SMR redundant array is solved, and the data consistency and normal operation of the disk array are realized.
Patent Information
- Application Number
- CN202510628656.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, when an SMR redundant array comes back online after a disk goes offline, the write pointer position is not updated, which prevents new business data from being written correctly and causes inconsistencies in the data on the same stripe across different disks.
By obtaining the reconstruction information table, data consistency verification is performed on the header stripes. Based on the verification results, the write pointer position is reset or partial reconstruction is performed to ensure data consistency.
It achieves consistency of stripe data among disks in an SMR redundant array, avoids the inability to partially rebuild stripes that have failed to be written, prevents the failure of areas to be rebuilt, and ensures the normal operation of the disk array.
Smart Images

Figure CN123114844A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage technology, and in particular to a method, apparatus, electronic device, and storage medium for partial reconstruction of a disk array. Background Technology
[0002] SMR (Shingled Magnetic Recording) disks are high-capacity disks that utilize a novel magnetic storage technology. SMR disks partially overlap the data tracks on the disk platter, a technique known as shingled magnetic recording. This technology involves very minor changes to the manufacturing process, yet can significantly increase disk storage density. In today's world of rapidly growing data volumes, SMR technology can effectively reduce the cost per unit capacity of disk storage and represents the future trend of high-density disk storage technology. In an SMR disk, each zone is composed of consecutive concentric tracks on the same platter, and the zones are physically separated and do not affect each other. Because the tracks on an SMR disk are partially overlapping, writing to an overwritten track may affect data on adjacent tracks. Therefore, data within a zone can only be written sequentially and does not support random writes. Each zone has a write pointer, and the write position must be at the location of the write pointer. If the written LBA (Logical Block Address) is inconsistent with the write pointer position, the SMR disk will report an error to the upper layer and return to the current write pointer position.
[0003] In existing technologies, when performing partial reconstruction of an SMR disk, the write pointer of the target SMR disk for partial reconstruction is reset, ensuring that the write pointer position for partial reconstruction is always the starting position of the write pointer, and this position remains fixed. This guarantees that the write pointer position can be obtained during the partial reconstruction process, avoids the loss of the write pointer position, and ensures the success rate of partial reconstruction of the SMR disk.
[0004] However, the aforementioned partial reconstruction method only records the business write traffic that existed after the SMR disks went offline. For SMR redundant arrays composed of SMR disks, when an offline SMR disk comes back online, the write pointer position in the zone remains at its pre-offline position. When new business data needs to be written, the position to be written is inconsistent with the current actual write pointer position, preventing the new data from being written correctly. This leads to data inconsistency in the same zone across the disks in the SMR redundant array. Therefore, providing a partial reconstruction method suitable for SMR redundant arrays is a pressing issue that needs to be addressed. Summary of the Invention
[0005] This invention provides a method, apparatus, electronic device, and storage medium for partial reconstruction of a disk array, which solves the defect in the prior art that causes data inconsistency in the same stripe of each disk when the partial reconstruction method is applied to an SMR redundant array.
[0006] This invention provides a method for local reconstruction of a disk array, comprising the following steps.
[0007] When a target disk in a disk array goes offline and then comes back online, a reconstruction information table corresponding to the target disk is obtained; the reconstruction information table is used to characterize the local information to be rebuilt in the target disk that failed to write, recorded in logical block address order.
[0008] The data consistency verification result of the header strip corresponding to the region to be reconstructed in the local information to be reconstructed is determined; the data consistency verification result is used to characterize whether the data between the header strip and the write pointer position in the region to be reconstructed is valid.
[0009] Based on the data consistency verification results and the reconstruction information table, the area to be reconstructed is partially reconstructed.
[0010] According to the disk array local reconstruction method provided by the present invention, the header stripe includes a first header stripe of equal spatial size and at least two second header stripes; The determination of the data consistency verification result of the header strip corresponding to the region to be reconstructed in the local information to be reconstructed includes: Obtain the first data of the first header block in the header stripe corresponding to the region to be reconstructed, and the second data of the second header blocks corresponding to at least two non-target disks in the header stripe; Perform an XOR operation on the second data corresponding to each of the second header bars to obtain the third data; The first data is compared with the third data to obtain the data consistency verification result of the head strip corresponding to the region to be reconstructed in the local information to be reconstructed.
[0011] According to the disk array partial reconstruction method provided by the present invention, the step of performing partial reconstruction of the area to be reconstructed based on the data consistency verification result and the reconstruction information table includes: If the data consistency verification result is that the first data and the third data are consistent, the local information to be reconstructed in the reconstruction information table is determined as the target reconstruction information, and the local reconstruction of the area to be reconstructed is performed based on the target reconstruction information. If the data consistency verification result shows that the first data and the third data are inconsistent, the write pointer position corresponding to the target disk is reset to the starting position of the region to be rebuilt; the local information to be rebuilt in the reconstruction information table is updated based on all the information to be rebuilt corresponding to the region to be rebuilt, and the all the information to be rebuilt is determined as the target reconstruction information; the region to be rebuilt is partially rebuilt based on the target reconstruction information, starting from the starting position.
[0012] According to the disk array partial reconstruction method provided by the present invention, the reconstruction information table includes a stripe to be reconstructed, a block to be reconstructed of the stripe to be reconstructed in the target disk, a region to be reconstructed where the stripe to be reconstructed is located, and the write pointer position corresponding to the region to be reconstructed; The step of performing local reconstruction of the region to be reconstructed based on the target reconstruction information includes: Traverse the blocks to be rebuilt in each of the stripes to be rebuilt, and determine the non-rebuild blocks of the current stripe to be rebuilt in each of the non-target disks; when all non-rebuild blocks are full, perform an XOR operation on the data in all non-rebuild blocks to obtain the first target data of the current block to be rebuilt in the current stripe to be rebuilt; write the first target data into the current block to be rebuilt, and update the write pointer position; After all data has been written to all blocks to be reconstructed, the final updated target write pointer position is obtained; based on the target write pointer position and the position to be written, the local reconstruction result of the region to be reconstructed is determined; the local reconstruction result is used to characterize whether the target write pointer position is consistent with the position to be written.
[0013] The disk array local reconstruction method provided by the present invention further includes: Obtain the read pointer position for reading the region to be reconstructed; Based on the read pointer position and the actual write pointer position, determine the second target data; The second target data is sent to the client.
[0014] According to the disk array partial reconstruction method provided by the present invention, determining the second target data based on the read pointer position and the actual write pointer position includes: If the read pointer position is less than the actual write pointer position, the data of the target block corresponding to the read pointer position is determined as the second target data; If the read pointer position is greater than or equal to the actual write pointer position, determine the data of the non-target block in the target strip where the read pointer position is located; perform an XOR operation on all the data of the non-target block to obtain the second target data of the target block corresponding to the read pointer position.
[0015] The disk array local reconstruction method provided by the present invention further includes: Obtain the location where data to be written to the region to be reconstructed; If the position to be written is inconsistent with the actual write pointer position, the reconstruction information table is updated based on the write failure block corresponding to the position to be written.
[0016] The present invention also provides a disk array local reconstruction device, comprising the following modules.
[0017] The acquisition module is used to acquire the reconstruction information table corresponding to the target disk when the target disk in the disk array is offline and then comes back online; the reconstruction information table is used to characterize the local information to be rebuilt in the target disk that failed to write, recorded in logical block address order.
[0018] The determination module is used to determine the data consistency verification result of the header strip corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency verification result is used to characterize whether the data between the header strip and the write pointer position in the region to be reconstructed is valid.
[0019] The local reconstruction module is used to perform local reconstruction of the area to be reconstructed based on the data consistency verification result and the reconstruction information table.
[0020] 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 computer program to implement the disk array local reconstruction method as described above.
[0021] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the disk array partial reconstruction method as described above.
[0022] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the disk array local reconstruction method as described above.
[0023] The disk array partial reconstruction method, apparatus, electronic device, and storage medium provided by this invention, when a target disk in a disk array goes offline and then comes back online, obtains a reconstruction information table corresponding to the target disk. The reconstruction information table records the partial information to be reconstructed that failed to write in the target disk according to the logical block address order. For the areas to be reconstructed that need partial reconstruction in the partial information, a header stripe data consistency check is performed to obtain a data consistency check result that characterizes whether the data between the header stripe and the write pointer position is valid. Based on the data consistency check result and the reconstruction information table, the areas to be reconstructed in the target disk are partially reconstructed. In this invention, by recording the partial information to be reconstructed during the target disk's offline and online periods in the reconstruction information table, it avoids the inability to partially reconstruct blocks that failed to write. The header stripe data consistency check prevents the areas to be reconstructed from becoming invalid. If the areas to be reconstructed are valid, all blocks in the areas to be reconstructed are partially reconstructed according to the recording order in the reconstruction information table, ensuring that the stripe data between disks in the disk array remains consistent. Attached Figure Description
[0024] 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.
[0025] Figure 1 This is a schematic flowchart of the disk array local reconstruction method provided in an embodiment of the present invention.
[0026] Figure 2 This is one of the example structural diagrams of a disk array provided in the embodiments of the present invention.
[0027] Figure 3 This is the second example structural schematic diagram of a disk array provided in the embodiments of the present invention.
[0028] Figure 4 This is a schematic diagram of the structure of the disk array local reconstruction device provided in an embodiment of the present invention.
[0029] Figure 5 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0030] 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.
[0031] To address the problem of data inconsistency on the same stripe across different disks when applying local reconstruction methods to SMR redundant arrays, this invention provides a disk array local reconstruction method. Figure 1 This is a flowchart illustrating the disk array local reconstruction method provided in an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes steps 110 to 130.
[0032] Step 110: When the target disk in the disk array is offline and then comes back online, obtain the reconstruction information table corresponding to the target disk; the reconstruction information table is used to characterize the local information to be rebuilt in the target disk that failed to write, recorded in logical block address order.
[0033] This disk array is a redundant SMR array, comprising at least three SMR (Shingled Magnetic Recording) disks. Each SMR disk includes a CMR (Conventional Magnetic Recording) perpendicular magnetic recording area and an SMR shingled magnetic recording area. In a conventional SMR disk, the CMR perpendicular magnetic recording area occupies 1% of the total SMR disk capacity, while the SMR shingled magnetic recording area occupies 99% of the total SMR disk capacity. In a hybrid SMR disk, the CMR perpendicular magnetic recording area accounts for an even larger proportion.
[0034] For example, Figure 2 This is one of the example structural diagrams of a disk array provided in an embodiment of the present invention, such as... Figure 2As shown, taking a disk array consisting of four SMR disks, designated as Rebuild Disk 1, Normal Disk 2, Normal Disk 3, and Normal Disk 4, Rebuild Disk 1 corresponds to zone 1, Normal Disk 2 to zone 2, Normal Disk 3 to zone 3, and Normal Disk 4 to zone 4. Each zone has a storage space of 256MB. Each zone includes multiple blocks of equal storage size located on multiple stripes. The appropriate block size can be set according to actual business needs, and the storage space size of each block can be any value within the range [4KB, 512KB]. Zone 1 includes block D0 on stripe 1, block D3 on stripe 2, block D6 on stripe 3, block P3 on stripe 4, and block D11 on stripe 5. Zone 2 includes block D1 on stripe 1, block D4 on stripe 2, block P2 on stripe 3, block D9 on stripe 4, and block D12 on stripe 5. Zone 3 includes block D2 on stripe 1, block P1 on stripe 2, block D7 on stripe 3, block D10 on stripe 4, and block D13 on stripe 5. Zone 4 includes block P0 on stripe 1, block D5 on stripe 2, block D8 on stripe 3, block D11 on stripe 4, and block P0 on stripe 5. All blocks are of equal size, and blocks D0 to D13 are data blocks, while blocks P0 to P3 are check blocks.
[0035] It should be noted that the data of all blocks on the same strip are consistent and redundant with each other.
[0036] The target disk and other non-target disks in the disk array are all SMR disks. If the target disk goes offline due to link instability or other intermittent failures, a reconstruction information table is created for the offline target disk in the NV-RAM (Nonvolatile Random Access Memory) area of the disk array. If there is service traffic during the offline period and after reconnection, all partial information requiring partial reconstruction that failed to be written during the offline period and after reconnection is recorded in LBA (Logical Block Address) order.
[0037] It's important to note that partial rebuilding refers to a normal LUN (Logical Unit Number) experiencing a disk removal or disk link instability leading to a momentary disk link failure and LUN degradation. If there is service traffic on this LUN, the system records the written stripes and marks the removed disk as Missing. Once the offline disk comes back online within a certain timeframe or the disk link is restored, the stripes written during the offline period are rebuilt, allowing the disk to be reused. If there is no service traffic during the disk removal or failure period, partial rebuilding will not be initiated. Partial rebuilding only applies to redundant RAID (Redundant Arrays of Independent Disks) LUNs. This includes all non-target disks in the RAID array that are in a normal state, traditional rebuilds, copy rebuilds, and the disk being rebuilt.
[0038] In addition, NV-RAM is a portion of the storage space allocated from the disk array write cache, used to record partial reconstruction information and write anomaly recovery information of the disk array.
[0039] It should be noted that this reconstruction information table includes only information related to the specific blocks within the region to be reconstructed, and does not include information about all blocks within the region. The local information to be reconstructed includes the stripe to be reconstructed, the block to be reconstructed within that stripe on the target disk, the region to be reconstructed where the stripe is located, and the write pointer position corresponding to that region. For example, Figure 3 This is a second example structural diagram of a disk array provided in an embodiment of the present invention, as shown below. Figure 3 As shown, taking disk 1 as the target disk for reconstruction as an example, when all four SMR disks in the disk array are functioning normally, the business write IO (Input / Output) sequentially writes to stripe 1. The write pointer position of disk 1 is at point A, the write pointer position of normal disk 2 is at point B, the write pointer position of normal disk 3 is at point C, and the write pointer position of normal disk 4 is at point J. After disk 1 goes offline, the business write IO continues to write data. During the offline period, the business write IO continues to write to stripe 2 and stripe 3. At this time, a reconstruction information table corresponding to disk 1 is created in the NV-RAM area. In this reconstruction information table, the stripes to be reconstructed during the offline period are recorded in logical block address order as stripe 2 and stripe 3. Figure 2 As shown, the stripe to be rebuilt in stripe 2 is stripe D3, and the stripe to be rebuilt in stripe 3 is stripe D6. The area to be rebuilt for both stripes is zone1. Before going offline, the write pointer position of zone1 on reconstruction disk 1 is point A. The reconstruction information table is shown in Table 1.
[0040] Table 1
[0041] It should be noted that if multiple strips to be reconstructed have the same area to be reconstructed, only one write pointer position needs to be recorded in the reconstruction information table.
[0042] In addition, the method also includes: Obtain the location where data to be written to the region to be reconstructed; If the position to be written is inconsistent with the actual write pointer position, the reconstruction information table is updated based on the write failure block corresponding to the position to be written.
[0043] The location to be written is the location where data needs to be written in the business write I / O sequence, and the actual write pointer position is the actual position of the write pointer on the target disk. For example, before the target disk comes back online and is partially rebuilt, the actual write pointer position on the target disk is the write pointer position corresponding to the area to be rebuilt before the target disk went offline. During the partial reconstruction of the target disk, the actual write pointer position on the target disk changes continuously as the partial reconstruction process progresses.
[0044] For example, such as Figure 3 As shown, taking rebuilt disk 1 as the target disk as an example, before rebuilt disk 1 is brought back online and partially rebuilt, business write IO to normal disks 2 to 3 is unaffected, and new data can be written sequentially. When writing to rebuilt disk 1, the position to be written sequentially is point G, while the actual write pointer position when rebuilt disk 1 is just brought back online is point A. At this time, the position to be written and the actual write pointer position are inconsistent, and the write fails. At this time, the write failure block corresponding to the position to be written G in rebuilt disk 1 is block P3. This write failure block is in stripe 4 and in zone 1. The actual write pointer position corresponding to zone 1 is point A. The block information corresponding to the above write failure block is added to the reconstruction information table. After the business write IO switches out of zone 1, the business writes in zones 2 to 4 are successful.
[0045] Step 120: Determine the data consistency verification result of the header strip corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency verification result is used to characterize whether the data between the header strip and the write pointer position in the region to be reconstructed is valid.
[0046] Specifically, after the target disk is brought back online, the region to be rebuilt in the reconstruction information table is queried, and the header stripe in the region to be rebuilt is checked for data consistency to obtain whether the data between the header stripe and the write pointer position is valid, that is, to determine whether the region to be rebuilt is valid.
[0047] Furthermore, the head strip includes a first head strip of equal spatial size and at least two second head strips; The determination of the data consistency verification result of the header strip corresponding to the region to be reconstructed in the local information to be reconstructed includes: Obtain the first data of the first header block in the header stripe corresponding to the region to be reconstructed, and the second data of the second header blocks corresponding to at least two non-target disks in the header stripe; Perform an XOR operation on the second data corresponding to each of the second header bars to obtain the third data; The first data is compared with the third data to obtain the data consistency verification result of the head strip corresponding to the region to be reconstructed in the local information to be reconstructed.
[0048] For example, such as Figure 3 As shown, the area to be reconstructed in the reconstruction information table is zone1. The header strip in zone1 is strip 1, which includes a first header block D0 in zone1, a second header block D1 in zone2, a second header block D2 in zone3, and a second header block P0 in zone4. Next, the first data in the first header block D0 and the second data in the second header blocks D1 to P0 are read. Since the data in all blocks on the same strip is redundant, the second data in the second header blocks D1 to P0 are XORed to obtain the third data. This third data is the standard data that should be written to the first header block D0. At this point, the first data and the third data can be compared to obtain the data consistency check result. If the first data and the third data are consistent, the data consistency check result indicates that the data between strip 1 and the write pointer position A is valid, i.e., zone1 is valid. If the first data and the third data are inconsistent, the data consistency check result indicates that the data between strip 1 and the write pointer position A is invalid, i.e., zone1 is invalid.
[0049] Step 130: Based on the data consistency verification result and the reconstruction information table, perform local reconstruction of the area to be reconstructed.
[0050] Specifically, after obtaining the data consistency verification result, the local information to be reconstructed in the reconstruction information table can be updated according to the data consistency verification result, and then the blocks that need to be reconstructed in the area to be reconstructed can be locally reconstructed according to the record order based on the local information to be reconstructed.
[0051] Further, the step of performing local reconstruction of the region to be reconstructed based on the data consistency verification result and the reconstruction information table includes: If the data consistency verification result is that the first data and the third data are consistent, the local information to be reconstructed in the reconstruction information table is determined as the target reconstruction information, and the local reconstruction of the area to be reconstructed is performed based on the target reconstruction information. If the data consistency verification result shows that the first data and the third data are inconsistent, the write pointer position corresponding to the target disk is reset to the starting position of the region to be rebuilt; the local information to be rebuilt in the reconstruction information table is updated based on all the information to be rebuilt corresponding to the region to be rebuilt, and the all the information to be rebuilt is determined as the target reconstruction information; the region to be rebuilt is partially rebuilt based on the target reconstruction information, starting from the starting position.
[0052] Specifically, if the first data and the third data are consistent, it indicates that the data between the header strip and the write pointer position in the region to be reconstructed is valid. In this case, there is no need to update the local information to be reconstructed in the reconstruction information table, and the local information to be reconstructed is determined as the target reconstruction information to be reconstructed. The region to be reconstructed is then reconstructed locally according to the order of the target reconstruction information. If the first data and the third data are inconsistent, it indicates that the data between the header strip and the write pointer position in the region to be reconstructed is invalid, that is, the region to be reconstructed is invalid. In this case, the region to be reconstructed is reset, the write pointer position is reset to the starting position in the region to be reconstructed, and all strips in the region to be reconstructed need to be reconstructed. That is, the previously recorded local information to be reconstructed in the reconstruction information table is cleared, and all the information to be reconstructed, including all strips in the region to be reconstructed, is added to the cleared reconstruction information table in sequence. All the information to be reconstructed is determined as the target reconstruction information to be reconstructed, and the region to be reconstructed locally is reconstructed locally starting from the starting position of the region to be reconstructed according to the order of the target reconstruction information.
[0053] Further, the step of performing local reconstruction of the region to be reconstructed based on the target reconstruction information includes: Traverse the blocks to be rebuilt in each of the stripes to be rebuilt, and determine the non-rebuild blocks of the current stripe to be rebuilt in each of the non-target disks; when all non-rebuild blocks are full, perform an XOR operation on the data in all non-rebuild blocks to obtain the first target data of the current block to be rebuilt in the current stripe to be rebuilt; write the first target data into the current block to be rebuilt, and update the write pointer position; After all data has been written to all blocks to be reconstructed, the final updated target write pointer position is obtained; based on the target write pointer position and the position to be written, the local reconstruction result of the region to be reconstructed is determined; the local reconstruction result is used to characterize whether the target write pointer position is consistent with the position to be written.
[0054] For example, taking the local information to be reconstructed in Table 1 as the target reconstruction information, firstly, the local reconstruction of the block D3 to be reconstructed in stripe 2 needs to be performed. This includes the following steps: First, determine the non-reconstruction blocks D4, P1, and D5 in normal disk 2, and determine whether they are full of data. If all three non-reconstruction blocks are full, read the data from the three blocks and perform an XOR operation to obtain the first target data. This first target data is the data that should be written into the block D3 to be reconstructed. Then, write the calculated first target data into the block D3 to be reconstructed and update the write pointer position from point A to point D. If at least one of the three non-reconstruction blocks is not filled, it indicates that strip 2 is not filled and local reconstruction of strip 2 is not required for the time being. At this time, local reconstruction can be paused and the system can poll to determine whether strip 2 is filled until strip 2 is filled and then local reconstruction can continue.
[0055] After the local reconstruction of block D3 in strip 2 is completed, the local reconstruction of block D6 in strip 3 is continued. When non-reconstruction blocks P2, D7, and D8 in strip 3 are all full, the data in the three non-reconstruction blocks are XORed to obtain the first target data, which is then written into block D6 in strip 3 and the write pointer position is updated from point D to point G.
[0056] After the local reconstruction of both strip D3 in strip 2 and strip D6 in strip 3 is completed, the final updated target write pointer position is point G, and the writing position is also point G. If the target write pointer position is consistent with the writing position, it indicates that the local reconstruction of the area to be reconstructed is successful. At this time, the target reconstruction information in the reconstruction information table can be cleared.
[0057] Furthermore, if the target write pointer position does not match the position to be written, the reconstructed disk 1 is removed, a new blank disk is added to the disk array, and a traditional reconstruction is performed on the blank disk. It should be noted that this traditional reconstruction involves reading data from the non-reconstructed disks in the disk array and calculating a checksum to write to the blank disk, thus achieving the reconstruction of the blank disk. After the blank disk reconstruction is completed, the disk array regains its redundancy.
[0058] During the partial reconstruction process, the target disk is removed again. At this point, it is necessary to determine whether a reconstruction information table for the target disk exists in the NV-RAM area. If it exists, the above partial reconstruction process can be executed. If it does not exist, the reconstruction information table corresponding to the target disk is first created in the NV-RAM area.
[0059] Furthermore, during the partial reconstruction process, if a non-target disk is removed, the disk array can be marked as failed, read and write operations on that disk array will cease, and an alarm message will be sent to the client. Once the non-target disk is back online, the above process can be repeated for partial reconstruction.
[0060] Furthermore, the method also includes: Obtain the read pointer position for reading the region to be reconstructed; Based on the read pointer position and the actual write pointer position, determine the second target data; The second target data is sent to the client.
[0061] Specifically, after the target disk comes online, business read I / O can be performed. Reading from non-target disks and non-reconstruction areas within the target disk remains unaffected, and business read I / O can be executed normally. When reading from the reconstruction area within the target disk, the read pointer position to be read in the reconstruction area can be obtained first. Based on the read pointer position and the actual write pointer position, it can be determined whether the read can be successful, thus obtaining the second target data. This second target data is then fed back to the client, without the upper layer being aware of it.
[0062] Furthermore, determining the second target data based on the read pointer position and the actual write pointer position includes: If the read pointer position is less than the actual write pointer position, the data of the target block corresponding to the read pointer position is determined as the second target data; If the read pointer position is greater than or equal to the actual write pointer position, determine the data of the non-target block in the target strip where the read pointer position is located; perform an XOR operation on all the data of the non-target block to obtain the second target data of the target block corresponding to the read pointer position.
[0063] For example, such as Figure 3 As shown, when the actual write pointer position is point G and the read pointer position is point A, according to the business order, the read pointer position point A is less than the actual write pointer position point G. At this time, the data of the target block D0 corresponding to the read pointer position A in zone1 can be read, and this data is the second target data.
[0064] For example, such as Figure 3As shown, when both the actual write pointer position and the read pointer position are point G, the data read from target block P3 corresponding to the actual write pointer position G has not yet been written. Therefore, the data read from target block P3 fails. At this time, the target strip where target block P3 is located is strip 4. Strip 4 also includes non-target stripes D9, D10, and D11. The data in these three non-target stripes is read, and the data in these three non-target stripes is XORed. The calculated data is the second target data that should be written into target block P3.
[0065] Furthermore, before a normal restart or shutdown of an electronic device, the reconstruction information table can be written to a local configuration file and read again upon the next startup to continue the above process. If the electronic device loses its reconstruction information table due to an abnormal power outage, causing it to be lost because the reconstruction information table was not written to the local configuration file in time, the electronic device can determine whether the reconstruction information table is valid upon the next startup. If the reconstruction information table is invalid, the target disk in the disk array can be removed, and a blank disk can be added for traditional reconstruction.
[0066] If the offline target disk does not come online within the specified time, a blank disk can be added to the disk array in place of the offline target disk. After that, a traditional rebuild can be triggered. At this time, the rebuild record related to the target disk in the rebuild information table can be deleted and released.
[0067] The disk array partial reconstruction method provided in this invention, when a target disk in the disk array goes offline and then comes back online, obtains a reconstruction information table corresponding to the target disk. The reconstruction information table records the partial information to be reconstructed that failed to write in the target disk according to the logical block address order. For the areas to be reconstructed that need partial reconstruction in the partial information, a header stripe data consistency check is performed to obtain a data consistency check result characterizing whether the data between the header stripe and the write pointer position is valid. Based on the data consistency check result and the reconstruction information table, the areas to be reconstructed in the target disk are partially reconstructed. In this invention, by recording the partial information to be reconstructed during the target disk's offline and online periods in the reconstruction information table, it avoids the inability to partially reconstruct blocks that failed to write. The header stripe data consistency check prevents the areas to be reconstructed from becoming invalid. If the areas to be reconstructed are valid, all blocks in the areas to be reconstructed are partially reconstructed according to the recording order in the reconstruction information table, ensuring that the stripe data between disks in the disk array remains consistent.
[0068] The disk array partial reconstruction apparatus provided by the present invention is described below. The disk array partial reconstruction apparatus described below can be referred to in correspondence with the disk array partial reconstruction method described above.
[0069] This invention also provides a disk array local reconstruction device. Figure 4This is a schematic diagram of the structure of the disk array partial reconstruction device provided in an embodiment of the present invention, as shown below. Figure 4 As shown, the disk array local reconstruction device 400 includes: an acquisition module 410, a determination module 420, and a local reconstruction module 430.
[0070] The acquisition module 410 is used to acquire the reconstruction information table corresponding to the target disk when the target disk in the disk array is offline and then comes back online; the reconstruction information table is used to characterize the local information to be rebuilt in the target disk that failed to write, recorded in logical block address order.
[0071] The determination module 420 is used to determine the data consistency verification result of the header strip corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency verification result is used to characterize whether the data between the header strip and the write pointer position in the region to be reconstructed is valid.
[0072] The local reconstruction module 430 is used to perform local reconstruction of the area to be reconstructed based on the data consistency verification result and the reconstruction information table.
[0073] The disk array partial reconstruction apparatus provided in this invention, when a target disk in the disk array goes offline and then comes back online, obtains a reconstruction information table corresponding to the target disk. The reconstruction information table records the partial information to be reconstructed that failed to write in the target disk according to the logical block address order. For the areas to be reconstructed that need partial reconstruction in the partial information, a header stripe data consistency check is performed to obtain a data consistency check result characterizing whether the data between the header stripe and the write pointer position is valid. Based on the data consistency check result and the reconstruction information table, the areas to be reconstructed in the target disk are partially reconstructed. In this invention, by recording the partial information to be reconstructed during the target disk's offline and online periods in the reconstruction information table, it avoids the inability to partially reconstruct blocks that failed to write. The header stripe data consistency check prevents the areas to be reconstructed from becoming invalid. If the areas to be reconstructed are valid, all blocks in the areas to be reconstructed are partially reconstructed according to the recording order in the reconstruction information table, ensuring that the stripe data between disks in the disk array remains consistent.
[0074] Optionally, the head strip includes a first head strip of equal spatial size and at least two second head strips.
[0075] Optionally, module 420 is specifically used for: Obtain the first data of the first header block in the header stripe corresponding to the region to be reconstructed, and the second data of the second header blocks corresponding to at least two non-target disks in the header stripe; Perform an XOR operation on the second data corresponding to each of the second header bars to obtain the third data; The first data is compared with the third data to obtain the data consistency verification result of the head strip corresponding to the region to be reconstructed in the local information to be reconstructed.
[0076] Optionally, the local reconstruction module 430 is specifically used for: If the data consistency verification result is that the first data and the third data are consistent, the local information to be reconstructed in the reconstruction information table is determined as the target reconstruction information, and the local reconstruction of the area to be reconstructed is performed based on the target reconstruction information. If the data consistency verification result shows that the first data and the third data are inconsistent, the write pointer position corresponding to the target disk is reset to the starting position of the region to be rebuilt; the local information to be rebuilt in the reconstruction information table is updated based on all the information to be rebuilt corresponding to the region to be rebuilt, and the all the information to be rebuilt is determined as the target reconstruction information; the region to be rebuilt is partially rebuilt based on the target reconstruction information, starting from the starting position.
[0077] Optionally, the reconstruction information table includes the stripe to be reconstructed, the block to be reconstructed of the stripe to be reconstructed in the target disk, the region to be reconstructed where the stripe to be reconstructed is located, and the write pointer position corresponding to the region to be reconstructed.
[0078] Optionally, the local reconstruction module 430 is specifically used for: Traverse the blocks to be rebuilt in each of the stripes to be rebuilt, and determine the non-rebuild blocks of the current stripe to be rebuilt in each of the non-target disks; when all non-rebuild blocks are full, perform an XOR operation on the data in all non-rebuild blocks to obtain the first target data of the current block to be rebuilt in the current stripe to be rebuilt; write the first target data into the current block to be rebuilt, and update the write pointer position; After all data has been written to all blocks to be reconstructed, the final updated target write pointer position is obtained; based on the target write pointer position and the position to be written, the local reconstruction result of the region to be reconstructed is determined; the local reconstruction result is used to characterize whether the target write pointer position is consistent with the position to be written.
[0079] Optionally, the disk array partial reconstruction device 400 further includes a service read module, which is specifically used for: Obtain the read pointer position for reading the region to be reconstructed; Based on the read pointer position and the actual write pointer position, determine the second target data; The second target data is sent to the client.
[0080] Optionally, this business read module is specifically used for: If the read pointer position is less than the actual write pointer position, the data of the target block corresponding to the read pointer position is determined as the second target data; If the read pointer position is greater than or equal to the actual write pointer position, determine the data of the non-target block in the target strip where the read pointer position is located; perform an XOR operation on all the data of the non-target block to obtain the second target data of the target block corresponding to the read pointer position.
[0081] Optionally, the disk array partial reconstruction device 400 further includes a service write module, which is specifically used for: Obtain the location where data to be written to the region to be reconstructed; If the position to be written is inconsistent with the actual write pointer position, the reconstruction information table is updated based on the write failure block corresponding to the position to be written.
[0082] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiment of the present invention, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communications interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a disk array partial reconstruction method. This method includes: when a target disk in the disk array is offline and then re-online, obtaining a reconstruction information table corresponding to the target disk; the reconstruction information table is used to characterize the local information to be reconstructed in the target disk that failed to write, recorded in logical block address order; determining the data consistency check result of the header stripe corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency check result is used to characterize whether the data between the header stripe and the write pointer position in the region to be reconstructed is valid; and performing partial reconstruction of the region to be reconstructed based on the data consistency check result and the reconstruction information table.
[0083] Furthermore, the logical instructions in the aforementioned memory 530 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, 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.
[0084] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the disk array partial reconstruction method provided by the above methods. The method includes: when a target disk in the disk array is offline and then comes back online, obtaining a reconstruction information table corresponding to the target disk; the reconstruction information table is used to characterize the local information to be reconstructed in the target disk that failed to write, recorded in logical block address order; determining the data consistency check result of the header stripe corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency check result is used to characterize whether the data between the header stripe and the write pointer position in the region to be reconstructed is valid; and performing partial reconstruction of the region to be reconstructed based on the data consistency check result and the reconstruction information table.
[0085] In another aspect, the present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a disk array partial reconstruction method provided by the above methods. The method includes: when a target disk in the disk array is offline and then re-online, obtaining a reconstruction information table corresponding to the target disk; the reconstruction information table is used to characterize the local information to be reconstructed in the target disk that failed to write, recorded in logical block address order; determining the data consistency check result of the header stripe corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency check result is used to characterize whether the data between the header stripe and the write pointer position in the region to be reconstructed is valid; and performing partial reconstruction of the region to be reconstructed based on the data consistency check result and the reconstruction information table.
[0086] 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.
[0087] 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.
[0088] 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 local reconstruction of a disk array, characterized in that, include: When a target disk in a disk array goes offline and then comes back online, a reconstruction information table corresponding to the target disk is obtained; the reconstruction information table is used to characterize the local information to be reconstructed in the target disk that failed to write, recorded in logical block address order. Determine the data consistency verification result of the header stripe corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency verification result is used to characterize whether the data between the header stripe and the write pointer position in the region to be reconstructed is valid. Based on the data consistency verification results and the reconstruction information table, the area to be reconstructed is partially reconstructed.
2. The disk array local reconstruction method according to claim 1, characterized in that, The head strip includes a first head strip of equal spatial size and at least two second head strips; The determination of the data consistency verification result of the header strip corresponding to the region to be reconstructed in the local information to be reconstructed includes: Obtain the first data of the first header block in the header stripe corresponding to the region to be reconstructed, and the second data of the second header blocks corresponding to at least two non-target disks in the header stripe; Perform an XOR operation on the second data corresponding to each of the second header bars to obtain the third data; The first data is compared with the third data to obtain the data consistency verification result of the head strip corresponding to the region to be reconstructed in the local information to be reconstructed.
3. The disk array local reconstruction method according to claim 2, characterized in that, The step of performing local reconstruction of the region to be reconstructed based on the data consistency verification result and the reconstruction information table includes: If the data consistency verification result is that the first data and the third data are consistent, the local information to be reconstructed in the reconstruction information table is determined as the target reconstruction information, and the local reconstruction of the area to be reconstructed is performed based on the target reconstruction information. If the data consistency verification result shows that the first data and the third data are inconsistent, the write pointer position corresponding to the target disk is reset to the starting position of the region to be rebuilt; the local information to be rebuilt in the reconstruction information table is updated based on all the information to be rebuilt corresponding to the region to be rebuilt, and the all the information to be rebuilt is determined as the target reconstruction information; the region to be rebuilt is partially rebuilt based on the target reconstruction information, starting from the starting position.
4. The disk array local reconstruction method according to claim 3, characterized in that, The reconstruction information table includes the stripe to be reconstructed, the block to be reconstructed of the stripe to be reconstructed in the target disk, the region to be reconstructed where the stripe to be reconstructed is located, and the write pointer position corresponding to the region to be reconstructed; The step of performing local reconstruction of the region to be reconstructed based on the target reconstruction information includes: Traverse the blocks to be rebuilt in each of the stripes to be rebuilt, and determine the non-rebuild blocks of the current stripe to be rebuilt in each of the non-target disks; when all non-rebuild blocks are full, perform an XOR operation on the data in all non-rebuild blocks to obtain the first target data of the current block to be rebuilt in the current stripe to be rebuilt; write the first target data into the current block to be rebuilt, and update the write pointer position; After all data has been written to all blocks to be reconstructed, the final updated target write pointer position is obtained; based on the target write pointer position and the position to be written, the local reconstruction result of the region to be reconstructed is determined; the local reconstruction result is used to characterize whether the target write pointer position is consistent with the position to be written.
5. The method for local reconstruction of a disk array according to any one of claims 1-4, characterized in that, The method further includes: Obtain the read pointer position for reading the region to be reconstructed; Based on the read pointer position and the actual write pointer position, determine the second target data; The second target data is sent to the client.
6. The disk array local reconstruction method according to claim 5, characterized in that, The determination of the second target data based on the read pointer position and the actual write pointer position includes: If the read pointer position is less than the actual write pointer position, the data of the target block corresponding to the read pointer position is determined as the second target data; If the read pointer position is greater than or equal to the actual write pointer position, determine the data of the non-target block in the target strip where the read pointer position is located; perform an XOR operation on all the data of the non-target block to obtain the second target data of the target block corresponding to the read pointer position.
7. The method for local reconstruction of a disk array according to any one of claims 1-4, characterized in that, The method further includes: Obtain the location where data to be written to the region to be reconstructed; If the position to be written is inconsistent with the actual write pointer position, the reconstruction information table is updated based on the write failure block corresponding to the position to be written.
8. A disk array local reconstruction device, characterized in that, include: The acquisition module is used to acquire the reconstruction information table corresponding to the target disk when the target disk in the disk array is offline and then comes back online; the reconstruction information table is used to characterize the local information to be rebuilt in the target disk that failed to write, recorded in logical block address order. The determination module is used to determine the data consistency verification result of the header stripe corresponding to the region to be reconstructed in the local information to be reconstructed; the data consistency verification result is used to characterize whether the data between the header stripe and the write pointer position in the region to be reconstructed is valid. The local reconstruction module is used to perform local reconstruction of the area to be reconstructed based on the data consistency verification result and the reconstruction information table.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the disk array local reconstruction method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the disk array local reconstruction method as described in any one of claims 1 to 7.
