Reconstruction method, device, equipment and system of independent redundant disk array

文档序号:1904110 发布日期:2021-11-30 浏览:2次 中文

阅读说明:本技术 一种独立冗余磁盘阵列的重构方法、装置、设备及系统 (Reconstruction method, device, equipment and system of independent redundant disk array ) 是由 朱红玉 梁欣玲 于 2021-07-29 设计创作,主要内容包括:本申请公开了一种独立冗余磁盘阵列的重构方法,在重构过程中该方法分三个阶段依次对热备区域、有效区域和无效区域进行重构,每个阶段独立计算重构进度。在对有效区域进行重构时,仅仅根据重构位图记录的尚未重构的区域的数量、热备区域的总数、有效区域位图记录的有效区域的总数即可实现对有效区域重构进度的更新,可见,该方法无需对重构位图和有效区域位图进行相交计算,大大节省了计算量,提升了重构效率。此外,本申请还提供了一种独立冗余磁盘阵列的重构装置、设备、系统及可读存储介质,其技术效果与上述方法的技术效果相对应。(The application discloses a reconstruction method of an independent redundant disk array, which comprises the steps of sequentially reconstructing a hot spare area, an effective area and an ineffective area in three stages in the reconstruction process, and independently calculating the reconstruction progress in each stage. When the effective area is reconstructed, the reconstruction progress of the effective area can be updated only according to the number of the areas which are recorded by the reconstruction bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap. In addition, the application also provides a reconstruction device, equipment, a system and a readable storage medium of the redundant array of independent disks, and the technical effect of the reconstruction device corresponds to that of the method.)

1. A reconstruction method of an independent redundant disk array is characterized by comprising the following steps:

dividing the target hard disk into areas according to a preset length to obtain an area set, wherein the area set comprises a hot standby area, an effective area and an invalid area; constructing a reconstruction bitmap and an effective region bitmap according to the region set, wherein the reconstruction bitmap is used for recording the reconstruction state of each region, and the effective region bitmap is used for indicating whether each region is an effective region;

searching for the hot standby area of the target hard disk, updating the reconstruction state of the hot standby area in the reconstruction bitmap to be reconstructed according to the searching result, and determining the total number of the hot standby area in the target hard disk;

when the effective area reconstruction progress does not reach 100%, reconstructing each effective area of the target hard disk according to the reconstruction bitmap and the effective area bitmap, updating the reconstruction bitmap in the reconstruction process, and updating the effective area reconstruction progress according to the number of the areas which are recorded by the reconstruction bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap until the effective area reconstruction progress reaches 100%;

when the reconstruction progress of the invalid region does not reach 100%, reconstructing each invalid region of the target hard disk respectively according to the reconstruction bitmap, updating the reconstruction bitmap in the reconstruction process, and updating the reconstruction progress of the invalid region according to the number of regions which are recorded by the reconstruction bitmap and are not reconstructed until the reconstruction progress of the invalid region reaches 100%.

2. The method of claim 1, wherein the updating the active area reconstruction schedule according to the number of not-yet-reconstructed areas of the reconstructed bitmap records, the total number of spared areas, and the total number of active areas of the active area bitmap records comprises:

calculating the number of the effective areas which are not reconstructed according to a first target formula according to the number of the areas which are not reconstructed and recorded by the reconstruction bitmap, the total number of the hot spare areas and the total number of the effective areas recorded by the effective area bitmap, wherein the first target formula is as follows:

remaining ═ count (vaildbittmap) + (buildbittmap) -spartotal, wherein remaining represents the number of active areas that have not yet been reconstructed, count (vaildbittmap) represents the total number of active areas recorded by the active area bitmap, count (buildbittmap) represents the number of areas recorded by the reconstruction bitmap that have not yet been reconstructed, and spartotal represents the total number of hot spare areas;

and determining the reconstruction progress of the effective area according to the number of the effective areas which are not reconstructed.

3. The method of claim 1, wherein the updating the invalid region reconstruction schedule based on the number of regions of the reconstructed bitmap record that have not been reconstructed comprises:

according to the number of the regions which are recorded by the reconstruction bitmap and are not reconstructed, calculating the number of the invalid regions which are not reconstructed according to a second target formula, wherein the second target formula is as follows:

remaining ═ count (rebuildbittmap), where remaining represents the number of invalid areas that have not been reconstructed, and count (rebuildbittmap) represents the number of areas recorded by the reconstruction bitmap that have not been reconstructed;

and determining the reconstruction progress of the invalid regions according to the number of the invalid regions which are not reconstructed.

4. The method of claim 1, wherein the updating the active area reconstruction schedule according to the number of not-yet-reconstructed areas of the reconstructed bitmap records, the total number of spared areas, and the total number of active areas of the active area bitmap records comprises:

according to a first frequency, updating the effective area reconstruction progress according to the number of the areas which are recorded by the reconstruction bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap;

correspondingly, the updating the invalid region reconstruction progress according to the number of the regions recorded by the reconstruction bitmap, which have not been reconstructed yet, includes:

and according to a second frequency, updating the invalid region reconstruction progress according to the number of the regions recorded by the reconstruction bitmap and not reconstructed yet.

5. The method of claim 1, wherein after the searching for the hot spare area of the target hard disk and updating the reconstruction state of the hot spare area in the reconstruction bitmap to be reconstructed according to the search result, the method further comprises:

and after all the hot standby areas of the target hard disk are found, generating information of 100% of the reconstruction progress of the hot standby areas so as to prompt the stage of entering the reconstruction effective area.

6. The method according to any one of claims 1 to 5, wherein the searching for the hot spare area of the target hard disk and updating the reconstruction state of the hot spare area in the reconstruction bitmap to be reconstructed according to the search result comprises:

and controlling all hosts related to the target hard disk to search the hot standby area of the target hard disk, and controlling the hosts to update the reconstruction state of the hot standby area in the local reconstruction bitmap into a reconstructed state according to the search result.

7. An apparatus for reconstructing an RAID, comprising:

the system comprises an area dividing module, a data processing module and a data processing module, wherein the area dividing module is used for carrying out area division on a target hard disk according to a preset length to obtain an area set, and the area set comprises a hot standby area, an effective area and an invalid area; constructing a reconstruction bitmap and an effective region bitmap according to the region set, wherein the reconstruction bitmap is used for recording the reconstruction state of each region, and the effective region bitmap is used for indicating whether each region is an effective region;

the hot standby area reconstruction module is used for searching the hot standby area of the target hard disk, updating the reconstruction state of the hot standby area in the reconstruction bitmap into a reconstructed state according to the searching result and determining the total number of the hot standby area in the target hard disk;

an effective region reconstruction module, configured to reconstruct each effective region of the target hard disk according to the reconstruction bitmap and the effective region bitmap when an effective region reconstruction progress does not reach 100%, update the reconstruction bitmap in a reconstruction process, and update the effective region reconstruction progress according to the number of regions recorded by the reconstruction bitmap that are not reconstructed, the total number of hot spare regions, and the total number of effective regions recorded by the effective region bitmap until the effective region reconstruction progress reaches 100%;

and the invalid region reconstruction module is used for reconstructing each invalid region of the target hard disk respectively according to the reconstruction bitmap when the reconstruction progress of the invalid region does not reach 100%, updating the reconstruction bitmap in the reconstruction process, and updating the reconstruction progress of the invalid region according to the number of the regions which are recorded by the reconstruction bitmap and are not reconstructed until the reconstruction progress of the invalid region reaches 100%.

8. An apparatus for reconstructing a redundant array of independent disks, comprising:

a memory: for storing a computer program;

a processor: for processing said computer program to implement a method of reconstructing a redundant array of independent disks according to any of claims 1 to 6.

9. A reconstruction system of a redundant array of independent disks, comprising a hard disk and at least one host, wherein the host is used for implementing the reconstruction method of the redundant array of independent disks according to any one of claims 1 to 6.

10. A readable storage medium having stored thereon a computer program for implementing the reconstruction method of a redundant array of independent disks according to any one of claims 1 to 6 when executed by a processor.

Technical Field

The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, a system, and a readable storage medium for reconstructing an independent redundant disk array.

Background

In a storage device, when a hard disk in a Redundant Array of Independent Disks (RAID) fails, reconstruction (rebuild), that is, restoration of data to a replacement hard disk is widely used as one of means for restoring data. With the continuous expansion of the array capacity, the data reconstruction amount is continuously increased due to the loss of the hard disk, and the time for recovering the data is continuously prolonged, so that how to replace the hard disk more quickly becomes a key point.

The method is widely applied to the mode of firstly searching the effective area of the hard disk, namely the area used by a user, and only reconstructing the effective area during reconstruction, but the area not used by the user in the array also needs to keep data consistency, and the consistency is broken by the loss of the hard disk data, so the area not used by the user also needs a corresponding algorithm to restore the consistency.

In the two-stage reconstruction algorithm, the reconstruction area is divided into an effective area and an invalid area for reconstruction respectively, so that the array reconstruction speed and the redundancy recovery speed are accelerated. The algorithm performs progress control through double bitmaps and relies on bitmap intersection queries for start and stop control. The specific algorithm either performs statistics of the remaining number of bitmaps based on pre-computed intersection bitmaps or determines the remaining number by bitmap traversal, both of which involve intersection computations and are therefore less capable. Unit conversion also affects the performance of the computation, involving unit inconsistencies in the dibit map.

In summary, how to provide a data reconstruction scheme to avoid the influence caused by intersection calculation is a problem to be solved by those skilled in the art.

Disclosure of Invention

The application aims to provide a reconstruction method, a reconstruction device, reconstruction equipment, a reconstruction system and a readable storage medium of an independent redundant disk array, which are used for solving the problem of low reconstruction efficiency caused by the fact that the existing data reconstruction scheme needs to carry out bitmap intersection operation. The specific scheme is as follows:

in a first aspect, the present application provides a method for reconstructing an independent redundant disk array, including:

dividing the target hard disk into areas according to a preset length to obtain an area set, wherein the area set comprises a hot standby area, an effective area and an invalid area; constructing a reconstruction bitmap and an effective region bitmap according to the region set, wherein the reconstruction bitmap is used for recording the reconstruction state of each region, and the effective region bitmap is used for indicating whether each region is an effective region;

searching for the hot standby area of the target hard disk, updating the reconstruction state of the hot standby area in the reconstruction bitmap to be reconstructed according to the searching result, and determining the total number of the hot standby area in the target hard disk;

when the effective area reconstruction progress does not reach 100%, reconstructing each effective area of the target hard disk according to the reconstruction bitmap and the effective area bitmap, updating the reconstruction bitmap in the reconstruction process, and updating the effective area reconstruction progress according to the number of the areas which are recorded by the reconstruction bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap until the effective area reconstruction progress reaches 100%;

when the reconstruction progress of the invalid region does not reach 100%, reconstructing each invalid region of the target hard disk respectively according to the reconstruction bitmap, updating the reconstruction bitmap in the reconstruction process, and updating the reconstruction progress of the invalid region according to the number of regions which are recorded by the reconstruction bitmap and are not reconstructed until the reconstruction progress of the invalid region reaches 100%.

Optionally, the updating the effective area reconstruction progress according to the number of the areas recorded by the reconstruction bitmap that are not reconstructed, the total number of the hot spare areas, and the total number of the effective areas recorded by the effective area bitmap includes:

calculating the number of the effective areas which are not reconstructed according to a first target formula according to the number of the areas which are not reconstructed and recorded by the reconstruction bitmap, the total number of the hot spare areas and the total number of the effective areas recorded by the effective area bitmap, wherein the first target formula is as follows:

remaining ═ count (vaildbittmap) + (buildbittmap) -spartotal, wherein remaining represents the number of active areas that have not yet been reconstructed, count (vaildbittmap) represents the total number of active areas recorded by the active area bitmap, count (buildbittmap) represents the number of areas recorded by the reconstruction bitmap that have not yet been reconstructed, and spartotal represents the total number of hot spare areas;

and determining the reconstruction progress of the effective area according to the number of the effective areas which are not reconstructed.

Optionally, the updating the invalid region reconstruction progress according to the number of the regions recorded by the reconstructed bitmap, including:

according to the number of the regions which are recorded by the reconstruction bitmap and are not reconstructed, calculating the number of the invalid regions which are not reconstructed according to a second target formula, wherein the second target formula is as follows:

remaining ═ count (rebuildbittmap), where remaining represents the number of invalid areas that have not been reconstructed, and count (rebuildbittmap) represents the number of areas recorded by the reconstruction bitmap that have not been reconstructed;

and determining the reconstruction progress of the invalid regions according to the number of the invalid regions which are not reconstructed.

Optionally, the updating the effective area reconstruction progress according to the number of the areas recorded by the reconstruction bitmap that are not reconstructed, the total number of the hot spare areas, and the total number of the effective areas recorded by the effective area bitmap includes:

according to a first frequency, updating the effective area reconstruction progress according to the number of the areas which are recorded by the reconstruction bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap;

correspondingly, the updating the invalid region reconstruction progress according to the number of the regions recorded by the reconstruction bitmap, which have not been reconstructed yet, includes:

and according to a second frequency, updating the invalid region reconstruction progress according to the number of the regions recorded by the reconstruction bitmap and not reconstructed yet.

Optionally, after the searching for the hot spare area of the target hard disk and updating the reconstruction state of the hot spare area in the reconstruction bitmap to be already reconstructed according to the search result, the method further includes:

and after all the hot standby areas of the target hard disk are found, generating information of 100% of the reconstruction progress of the hot standby areas so as to prompt the stage of entering the reconstruction effective area.

Optionally, the searching for the hot spare area of the target hard disk, and updating the reconstruction state of the hot spare area in the reconstruction bitmap to be already reconstructed according to the search result includes:

and controlling all hosts related to the target hard disk to search the hot standby area of the target hard disk, and controlling the hosts to update the reconstruction state of the hot standby area in the local reconstruction bitmap into a reconstructed state according to the search result.

In a second aspect, the present application provides a reconstruction apparatus for a redundant array of independent disks, including:

the system comprises an area dividing module, a data processing module and a data processing module, wherein the area dividing module is used for carrying out area division on a target hard disk according to a preset length to obtain an area set, and the area set comprises a hot standby area, an effective area and an invalid area; constructing a reconstruction bitmap and an effective region bitmap according to the region set, wherein the reconstruction bitmap is used for recording the reconstruction state of each region, and the effective region bitmap is used for indicating whether each region is an effective region;

the hot standby area reconstruction module is used for searching the hot standby area of the target hard disk, updating the reconstruction state of the hot standby area in the reconstruction bitmap into a reconstructed state according to the searching result and determining the total number of the hot standby area in the target hard disk;

an effective region reconstruction module, configured to reconstruct each effective region of the target hard disk according to the reconstruction bitmap and the effective region bitmap when an effective region reconstruction progress does not reach 100%, update the reconstruction bitmap in a reconstruction process, and update the effective region reconstruction progress according to the number of regions recorded by the reconstruction bitmap that are not reconstructed, the total number of hot spare regions, and the total number of effective regions recorded by the effective region bitmap until the effective region reconstruction progress reaches 100%;

and the invalid region reconstruction module is used for reconstructing each invalid region of the target hard disk respectively according to the reconstruction bitmap when the reconstruction progress of the invalid region does not reach 100%, updating the reconstruction bitmap in the reconstruction process, and updating the reconstruction progress of the invalid region according to the number of the regions which are recorded by the reconstruction bitmap and are not reconstructed until the reconstruction progress of the invalid region reaches 100%.

In a third aspect, the present application provides a reconstruction apparatus for a redundant array of independent disks, including:

a memory: for storing a computer program;

a processor: for processing the computer program to implement the reconstruction method of the redundant array of independent disks as described above.

In a fourth aspect, the present application provides a system for reconstructing an array of independent redundant disks, including a hard disk and at least one host, where the host is configured to implement the method for reconstructing an array of independent redundant disks as described above.

In a fifth aspect, the present application provides a readable storage medium, on which a computer program is stored, the computer program being executed by a processor to implement the reconstruction method of the redundant array of independent disks as described above.

The reconstruction method of the redundant array of independent disks provided by the application comprises the following steps: dividing the target hard disk into areas according to a preset length to obtain an area set, wherein the area set comprises a hot standby area, an effective area and an ineffective area; constructing a reconstruction bitmap and an effective region bitmap according to the region set, wherein the reconstruction bitmap is used for recording the reconstruction state of each region, and the effective region bitmap is used for indicating whether each region is an effective region; firstly, reconstructing a hot standby area, searching the hot standby area of a target hard disk, updating the reconstruction state of the hot standby area in a reconstruction bitmap into a reconstructed state according to a search result, and determining the total number of the hot standby area in the target hard disk; then reconstructing the effective area, reconstructing each effective area of the target hard disk according to the reconstructed bitmap and the effective area bitmap, updating the reconstructed bitmap in the reconstruction process, and updating the effective area reconstruction progress according to the number of the areas which are recorded by the reconstructed bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap until the effective area reconstruction progress reaches 100%; and finally, reconstructing the invalid regions, reconstructing each invalid region of the target hard disk according to the reconstructed bitmap, updating the reconstructed bitmap in the reconstruction process, and updating the reconstruction progress of the invalid regions according to the number of the regions which are recorded by the reconstructed bitmap and are not reconstructed until the reconstruction progress of the invalid regions reaches 100%.

Therefore, in the reconstruction process, the method reconstructs the hot standby area, the effective area and the invalid area in three stages in sequence, and each stage independently calculates the reconstruction progress. When the effective area is reconstructed, the effective area reconstruction progress can be updated only according to the number of the areas which are recorded by the reconstructed bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap.

In addition, the present application further provides a device, an apparatus, a system and a readable storage medium for reconstructing an raid, where the technical effect of the method corresponds to the technical effect of the method, and is not described herein again.

Drawings

For a clearer explanation of the embodiments or technical solutions of the prior art of the present application, the drawings needed for the description of the embodiments or prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

Fig. 1 is a flowchart of a first embodiment of a reconstruction method for an raid provided in the present application;

fig. 2 is a flowchart of a second embodiment of a reconstruction method for an raid provided in the present application;

fig. 3 is a schematic process diagram of a second embodiment of a reconstruction method for an raid array according to the present invention;

fig. 4 is a schematic diagram of an embodiment of a reconstruction apparatus for a redundant array of independent disks provided in the present application.

Detailed Description

In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

The core of the application is to provide a reconstruction method, a reconstruction device, a reconstruction equipment, a reconstruction system and a readable storage medium of an independent redundant disk array, which can complete the calculation of the reconstruction progress with a smaller calculation amount, control the start and the stop of the stage in a more efficient manner, ensure the control effect of the reconstruction progress and improve the reconstruction efficiency.

Referring to fig. 1, a first embodiment of a method for reconstructing an raid provided in the present application is described below, where the first embodiment includes:

s11, performing area division on the target hard disk according to the preset length to obtain an area set; constructing a reconstruction bitmap and an effective region bitmap according to the region set;

the target hard disk refers to a hard disk with lost data to be reconstructed.

Specifically, the hard disk may be divided into a hot spare area and a data area, and the data area is further divided into an active area, i.e., an area used by a user, and an inactive area, i.e., an area not used by the user, so that the area set includes the hot spare area, the active area, and the inactive area.

The reconstruction bitmap is used for recording reconstruction states of each area, including a reconstructed state and an unreformed state. The valid area bitmap is used to indicate whether each area is a valid area, and includes a yes state and a no state.

S12, searching for a hot standby area of the target hard disk, updating the reconstruction state of the hot standby area in the reconstruction bitmap into a reconstructed state according to the search result, and determining the total number of the hot standby area in the target hard disk;

specifically, the hot standby area does not need to be reconstructed, so that the hot standby area can be directly skipped in the reconstruction process.

S13, reconstructing each effective area of the target hard disk respectively according to the reconstructed bitmap and the effective area bitmap, updating the reconstructed bitmap in the reconstruction process, and updating the effective area reconstruction progress according to the number of the areas which are recorded by the reconstructed bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap until the effective area reconstruction progress reaches 100%;

the total number of the hot spare areas in the target hard disk can be determined through S12, and it can be understood that, in practical applications, the hot spare areas and the data areas have a one-to-one correspondence relationship, so that the total number of the hot spare areas is equal to the total number of the data areas, that is, the total number of the hot spare areas is equal to the sum of the total number of the valid areas and the total number of the invalid areas. Therefore, according to the mathematical relationship, the number of the effective regions which are not reconstructed can be determined according to the number of the regions which are not reconstructed, the total number of the hot standby regions and the total number of the effective regions, and then the reconstruction progress of the effective regions can be determined according to the number of the effective regions which are not reconstructed.

And S14, reconstructing each invalid region of the target hard disk respectively according to the reconstructed bitmap, updating the reconstructed bitmap in the reconstruction process, and updating the invalid region reconstruction progress according to the number of the regions which are recorded by the reconstructed bitmap and are not reconstructed until the invalid region reconstruction progress reaches 100%.

Since the reconstruction of the hot spare area and the valid area is completed in S12 and S13, respectively, all areas to be reconstructed in S14 are invalid areas, and therefore, the number of invalid areas that have not been reconstructed can be determined according to the reconstruction bitmap, and the reconstruction progress of the invalid areas is determined according to the number of invalid areas that have not been reconstructed.

In this embodiment, the default bitmap is persistent, and the persistence is specifically implemented based on a power failure protection mechanism of the system or other mechanisms, so that the bitmap is guaranteed to be applied in the device.

The embodiment adopts a programming language to realize algorithm, uses a storage server or other devices capable of running redundant disk array logic as a running carrier after compiling, and can be easily configured to be used in any array logic supporting initialization, reconstruction and copyback.

The reconstruction method of the redundant array of independent disks provided in this embodiment reconstructs the hot spare area, the valid area, and the invalid area in three stages, and each stage independently calculates the reconstruction progress. When the effective area is reconstructed, the effective area reconstruction progress can be updated only according to the number of the areas which are recorded by the reconstructed bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap.

The second embodiment of the reconstruction method of the redundant array of independent disks provided by the present application is described in detail below, and the second embodiment is implemented based on the first embodiment and is expanded to a certain extent on the basis of the first embodiment.

First, to further improve the reconstruction efficiency, the second embodiment does not update the reconstruction progress every time an area is reconstructed, but updates the reconstruction progress according to a certain frequency. Since the hot spare area does not need to be reconstructed, this strategy is mainly applied to the reconstruction process of the active area and the reconstruction process of the inactive area. Therefore, the second embodiment not only reduces the calculation amount of the reconstruction progress, but also reduces the calculation frequency of the reconstruction progress.

Secondly, considering that a hard disk often corresponds to a plurality of hosts, and the plurality of hosts reconstruct the hard disk simultaneously in the reconstruction process, the reconstruction bitmaps on the hosts need to be ensured to be consistent, and the bitmap synchronization process is time-consuming. Therefore, in the second embodiment, when the hot standby area is reconstructed, each host is controlled to perform reconstruction operation respectively, and each host independently updates the reconstructed bitmap, so that the bitmap synchronization process is avoided, and the reconstruction efficiency is further improved.

Referring to fig. 2 and 3, the second embodiment specifically includes:

s21, performing area division on the target hard disk according to the preset length to obtain an area set; constructing a reconstruction bitmap and an effective region bitmap according to the region set;

s22, searching a hot standby area of the target hard disk, and updating the reconstruction state of the hot standby area in the reconstruction bitmap into a reconstructed state according to the search result;

the present embodiment performs reconstruction in three stages, i.e., a hot spare area reconstruction stage, an effective area reconstruction stage, and an ineffective area reconstruction stage. In this embodiment, in the active area reconstruction stage and the inactive area reconstruction stage, the reconstruction bitmaps on different hosts are synchronized, and in the hot standby area reconstruction stage, the reconstruction bitmaps on different hosts do not need to be synchronized.

Specifically, all hosts related to the target hard disk are controlled to search the hot standby area of the target hard disk, and the host is controlled to update the reconstruction state of the hot standby area in the local reconstruction bitmap to be reconstructed according to the search result. That is, in this embodiment, each host independently performs the hot spare area reconfiguration operation and updates the reconfiguration bitmap, and therefore, synchronization is not required.

S23, after all hot spare areas of the target hard disk are found, determining the total number of the hot spare areas in the target hard disk, and generating information that the reconstruction progress of the hot spare areas is 100% to prompt the stage of entering the reconstruction effective area.

In this embodiment, the hot standby area reconstruction progress does not need to be updated frequently in the hot standby area reconstruction process, and the hot standby area reconstruction progress is determined to be 100% only after all the hot standby areas are reconstructed.

S24, reconstructing each effective area of the target hard disk respectively according to the reconstructed bitmap and the effective area bitmap, updating the reconstructed bitmap in the reconstruction process, and updating the effective area reconstruction progress according to the number of the areas which are recorded by the reconstructed bitmap and are not reconstructed, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap according to the first frequency until the effective area reconstruction progress reaches 100%;

specifically, the number of the effective areas which are not reconstructed is calculated according to a first target formula according to the number of the areas which are not reconstructed and recorded by the reconstruction bitmap, the total number of the hot standby areas and the total number of the effective areas recorded by the effective area bitmap; and then determining the reconstruction progress of the effective area according to the number of the effective areas which are not reconstructed yet. The first target formula is:

remainingcount ═ count (vaildbittmap) + (buildbittmap) — sharetotal, where remainingcount represents the number of active areas that have not yet been reconstructed, count (vaildbittmap) represents the total number of active areas recorded by the active area bitmap, count (buildbittmap) represents the number of areas recorded by the reconstructed bitmap that have not yet been reconstructed, and sharetotal represents the total number of hot spare areas.

And S25, reconstructing each invalid region of the target hard disk respectively according to the reconstructed bitmap, updating the reconstructed bitmap in the reconstruction process, and updating the invalid region reconstruction progress according to the number of the regions which are recorded by the reconstructed bitmap and are not reconstructed according to a second frequency until the invalid region reconstruction progress reaches 100%.

And according to the number of the regions which are recorded by the reconstructed bitmap and are not reconstructed, calculating the number of the invalid regions which are not reconstructed according to a second target formula, and according to the number of the invalid regions which are not reconstructed, determining the reconstruction progress of the invalid regions. The second target formula is:

remaining ═ count (rebuildbittmap), where remaining denotes the number of invalid areas that have not been reconstructed, and count (rebuildbittmap) denotes the number of areas recorded by the reconstructed bitmap that have not been reconstructed.

As described above, in this embodiment, the effective region reconstruction progress and the ineffective region reconstruction progress are updated according to the first frequency and the second frequency, where the first frequency and the second frequency may be set and adjusted according to actual requirements, and the specific values of the first frequency and the second frequency are not limited in this embodiment.

Based on the second embodiment, the whole implementation process will be described below by taking a specific application as an example.

First, a setting progress calculation formula is as follows:

progress=(total-remaining)/total*100%

when reconstruction is carried out, the whole hard disk is divided into areas according to a certain length L, total represents the total number of the areas, and remaining represents the number of the areas which are not reconstructed. It is worth mentioning that three stages respectively adopt different progress calculation modes: in the hot standby area reconstruction stage, total represents the total number of the hot standby areas, and remaining represents the number of the hot standby areas which are not reconstructed; in the effective area reconstruction stage, total represents the total number of effective areas, and remaining represents the number of effective areas which are not reconstructed; in the invalid region reconstruction stage, total represents the total number of invalid regions, and remaining represents the number of invalid regions that have not been reconstructed.

And constructing a reconstruction bitmap and an effective region bitmap, wherein the reconstruction bitmap is used for recording the reconstruction state of each region, including reconstruction and non-reconstruction, 1 in the reconstruction bitmap represents non-reconstruction, and 0 represents reconstruction. The valid area bitmap is used for recording whether each area is a valid area, wherein in the valid area bitmap, 1 represents a valid area, and 0 represents an invalid area.

The first stage, the hot standby area reconstruction stage, finds all hot standby areas and updates the reconstruction bitmap. After the distributed array disk is lost, the disk contains the reserved hot standby area, and the hot standby area does not need to be reconstructed, so that the hot standby area can be directly skipped in the reconstruction process.

It is worth mentioning that the first-stage operation is executed at the same time at each host, and the single scanning is performed to perform the first time of progress calculation after the execution is finished, so that the progress calculation operation in the middle process and the backup synchronization operation among different hosts are avoided, and the performance is improved.

Therefore, the formula for the remaining calculation formula in the first stage is:

remaining=0

in this embodiment, the spare total represents the total number of the hot spare area, and once the array is initialized, the array is not changed, and after the first stage is finished, the spare total is calculated according to the following formula:

spareTotal=total-Count(rebuildBitmap)

wherein, count (rebuildbitmap) represents the number of 1 in the reconstructed bitmap, and can be obtained by bitmap statistical calculation.

The progress calculation of the first phase is performed only once, being performed after the end of a single scan.

And a second stage, namely an effective area reconstruction stage, reconstructing the effective area and updating the reconstructed bitmap. The remaininging calculation formula used at this stage is:

remaining=Count(vaildBitmap)+Count(rebuildBitmap)-spareTotal

wherein, count (vaildbitmap) represents the number of 1 in the effective area bitmap, and can be calculated by bitmap statistics.

And a third stage, namely an invalid region reconstruction stage, reconstructing the invalid region and updating the reconstructed bitmap. The remaininging calculation formula used at this stage is:

remaining=Count(rebuildBitmap)

in this embodiment, the reconstruction schedules of the second and third stages are executed according to the designated refresh frequency, and compared with the existing method of refreshing the reconstruction schedule once every region is reconstructed, this embodiment can reduce the number of times of updating the reconstruction schedule, thereby reducing the performance loss.

The following describes a reconstruction apparatus of an raid provided in an embodiment of the present application, and the reconstruction apparatus of an raid described below and the reconstruction method of an raid described above may be referred to correspondingly.

As shown in fig. 4, the reconstruction apparatus of the redundant array of independent disks of this embodiment includes:

the region dividing module 41 is configured to perform region division on the target hard disk according to a preset length to obtain a region set, where the region set includes a hot standby region, an effective region, and an invalid region; constructing a reconstruction bitmap and an effective region bitmap according to the region set, wherein the reconstruction bitmap is used for recording the reconstruction state of each region, and the effective region bitmap is used for indicating whether each region is an effective region;

the hot standby area reconstruction module 42 is configured to search for a hot standby area of the target hard disk, update the reconstruction state of the hot standby area in the reconstruction bitmap to be reconstructed according to the search result, and determine the total number of the hot standby area in the target hard disk;

an effective region reconstruction module 43, configured to reconstruct each effective region of the target hard disk according to the reconstruction bitmap and the effective region bitmap when the effective region reconstruction progress does not reach 100%, update the reconstruction bitmap in the reconstruction process, and update the effective region reconstruction progress according to the number of regions that are recorded by the reconstruction bitmap and that have not been reconstructed, the total number of hot standby regions, and the total number of effective regions recorded by the effective region bitmap until the effective region reconstruction progress reaches 100%;

and the invalid region reconstruction module 44 is configured to reconstruct each invalid region of the target hard disk according to the reconstruction bitmap when the reconstruction progress of the invalid region does not reach 100%, update the reconstruction bitmap in the reconstruction process, and update the reconstruction progress of the invalid region according to the number of the regions recorded by the reconstruction bitmap, which are not reconstructed, until the reconstruction progress of the invalid region reaches 100%.

The reconstruction apparatus of an raid of this embodiment is used to implement the reconstruction method of an raid described above, so a specific implementation of the apparatus may be found in the foregoing embodiment of the reconstruction method of an raid, and details are not described here.

In addition, the present application also provides a reconstruction device of an independent redundant disk array, including:

a memory: for storing a computer program;

a processor: for processing the computer program to implement the reconstruction method of a redundant array of independent disks as described above.

The present application further provides a system for reconstructing an raid comprising a hard disk and at least one host, where the host is configured to implement the method for reconstructing an raid as described above.

Finally, the present application also provides a readable storage medium having stored thereon a computer program for implementing the reconstruction method of the redundant array of independent disks as described above when the computer program is executed by a processor.

The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.

The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

The above detailed descriptions of the solutions provided in the present application, and the specific examples applied herein are set forth to explain the principles and implementations of the present application, and the above descriptions of the examples are only used to help understand the method and its core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种存储系统中双活卷的数据写入方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类