Disk array online expansion method, device, equipment and storage medium
By dividing target disks and disk groups in the disk array, storing data and redistributing data and scheduling failed disk reconstruction threads, the problem of increased energy consumption of the disk array is solved, and the dual goals of energy consumption reduction and data availability are achieved.
Patent Information
- Application Number
- CN202311789783.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2043-12-22
AI Technical Summary
The existing disk array expansion method results in increased energy consumption, making it difficult to effectively reduce the energy consumption of the disk array.
By dividing the target disk, the first disk group and the second disk group in the disk array, when storing data, the first data is stored in the target disk, and each copy of the second data has two copies of backup data stored in the first disk group and the second disk group respectively. In the two disk groups, the data storage settings are determined based on the number of disks and the number of data copies to implement data redistribution and scheduling of failed disk reconstruction threads to reduce energy consumption.
It achieves the effect of reducing energy consumption when expanding the disk array, while ensuring the availability of data and the normal operation of the system.
Smart Images

Figure CN117908780B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data storage technology, and in particular to a disk array online capacity expansion method, device, equipment and storage medium. Background Art
[0002] The data storage problem has become an important issue in the information age. With the explosive growth of data volume, the expansion of RAID (disk array) storage system is very important.
[0003] In the existing disk array expansion method, all data in the RAID system is backed up, new RAID storage space is reconfigured, and then the data is restored to the new RAID system. In this way, although the storage capacity can be increased through expansion, the energy consumption of the disk array is also increasing as the storage scale increases. Summary of the invention
[0004] The present invention provides a disk array online capacity expansion method, device, equipment and storage medium, which are used to solve the defect of high energy consumption of the disk array in the prior art and achieve the effect of reducing the energy consumption of the disk array.
[0005] The present invention provides a disk array online capacity expansion method, comprising:
[0006] Determine the data storage setting after the expansion based on the number of disks in the disk array after the newly added disk and the number of data copies stored in the disk array, wherein in the data storage setting after the expansion, the first data is stored in the target disk of the disk array, the second data has two backup data, and the two backup data of each copy of the second data are respectively stored in the first disk group and the second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk;
[0007] Determine whether there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is used to transfer data stored in the failed disk to a valid replacement disk;
[0008] When there is no unfinished failed disk reconstruction thread in the disk array, the data stored in the disk array is redistributed and stored based on the expanded data storage setting.
[0009] According to a method for online capacity expansion of a disk array provided by the present invention, the method of determining the data storage setting after capacity expansion based on the number of disks in the disk array after the newly added disk and the number of data stored in the disk array comprises:
[0010] Calculate (n-id+j)mod(x);
[0011] When (n-id+j)mod(x) is equal to 0, it is determined that the storage location of the data corresponding to the id value in the data storage setting is Disk(2x), Strip((j+1)mod(n-1)), where Disk(2x), Strip((j+1)mod(n-1)) represents the stripe storage area corresponding to the value of (j+1)mod(n-1) in the disk corresponding to the value of 2x;
[0012] When (n-id+j)mod(x) is not equal to 0, it is determined that the storage location of the data corresponding to the id value in the data storage setting is Disk(x), Strip((j+1)mod(n-1)), where Disk(x), Strip((j+1)mod(n-1)) represents the stripe storage area corresponding to the value of (j+1)mod(n-1) in the disk corresponding to the value of x;
[0013] n is the number of disks in the disk array after the new disk is added, the value range of id is [1,2,3,…m], m is the number of copies of the second data in the disk array, the value range of j is [0,1,2,3,…m-2], and x is the number of disks in each disk group.
[0014] According to a disk array online capacity expansion method provided by the present invention, before determining whether there is an unfinished failed disk reconstruction thread in the disk array, the method includes:
[0015] receiving a read / write request for a failed disk area, wherein the failed disk area is a failed disk and a disk area in the same stripe as the failed disk among other disks;
[0016] If the number of hotspot areas in the disk array is not greater than the number of hotspot area descriptions, the disk area corresponding to the read / write request is used as a hotspot area, and the number of read / write times of the disk area corresponding to the read / write request is increased by 1, and it is determined whether there is a target reconstruction thread. If not, the target reconstruction thread is established, and the target reconstruction thread is the failed disk reconstruction thread for the disk area corresponding to the read / write request;
[0017] If the number of the hot spots in the disk array is greater than the number of hot spots described, the read and write requests are suspended until the number of the hot spots in the disk array is no greater than the number of hot spots described.
[0018] According to a disk array online capacity expansion method provided by the present invention, after determining whether there is an unfinished failed disk reconstruction thread in the disk array, the method includes:
[0019] When there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is scheduled for execution based on the area tag corresponding to the failed disk reconstruction thread, and the area tag corresponding to the failed disk reconstruction thread reflects whether the disk area corresponding to the failed disk reconstruction thread is the hot spot area.
[0020] According to a disk array online expansion method provided by the present invention, the scheduling and execution of the failed disk reconstruction thread based on the area label corresponding to the failed disk reconstruction thread includes:
[0021] When the first condition or the second condition is met, the default scheduling thread is used to schedule the failed disk reconstruction thread for execution, otherwise the non-default scheduling thread is used to schedule the failed disk reconstruction thread for execution, the first condition is that there is no external workload when scheduling the failed disk reconstruction thread, and the second condition is that the currently existing failed disk reconstruction threads have all been completed or the currently existing failed disk reconstruction threads are in a running state and no new hotspot area is created;
[0022] When the default scheduling thread is used to schedule the failed disk reconstruction thread for execution, data stored in all data units corresponding to the failed disk reconstruction thread are transferred to the replacement disk at one time;
[0023] When the non-default scheduling thread is used to schedule the failed disk reconstruction thread for execution, the data unit corresponding to the failed disk reconstruction thread is reconstructed based on whether the hot spot area currently exists and whether the failed disk reconstruction thread currently exists in a running state.
[0024] According to a disk array online capacity expansion method provided by the present invention, after scheduling and executing the failed disk reconstruction thread based on the area label corresponding to the failed disk reconstruction thread, the method further includes:
[0025] When the failed disk area corresponding to the failed disk reconstruction thread has been completely rebuilt, the hot spot area corresponding to the failed disk reconstruction thread is eliminated;
[0026] If the number of the hot spots in the disk array is greater than a preset threshold after the failed disk reconstruction thread is scheduled to be executed n times in succession, some of the hot spots are eliminated from the current hot spots.
[0027] The present invention also provides a disk array online capacity expansion device, comprising:
[0028] a layout setting module, used for determining a data storage setting after expansion based on the number of disks in the disk array after the newly added disk and the number of data copies stored in the disk array, wherein in the data storage setting after expansion, first data is stored in a target disk of the disk array, second data has two backup data, and the two backup data of each second data are respectively stored in a first disk group and a second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk;
[0029] A reconstruction confirmation module, used to determine whether there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is used to transfer data stored in the failed disk to a valid replacement disk;
[0030] The data migration module is used to redistribute and store the data stored in the disk array based on the data storage setting after the expansion when there is no unfinished failed disk reconstruction thread in the disk array.
[0031] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned disk array online expansion methods is implemented.
[0032] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the online capacity expansion method of a disk array as described above is implemented.
[0033] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for online capacity expansion of a disk array.
[0034] The disk array online expansion method, device, equipment and storage medium provided by the present invention divide the expanded disk array into a target disk, a first disk group and a second disk group, and divide the data stored in the disk array into first data and second data. The complete data of each first data in the disk array is stored in the target disk, and each second data has two backup data, which are stored in the first disk group and the second disk group respectively. In this way, the disks in a disk group can be shut down arbitrarily and the availability of all data can be fully guaranteed, thereby achieving the effect of reducing the energy consumption of the disk array. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 This is one of the flow diagrams of a disk array online capacity expansion method provided by the present invention;
[0037] Figure 2 This is the second flow chart of a disk array online capacity expansion method provided by the present invention;
[0038] Figure 3 It is a schematic diagram of data storage settings in a disk array online capacity expansion method provided by the present invention;
[0039] Figure 4 It is a schematic diagram of a process for determining data storage settings in a disk array online capacity expansion method provided by the present invention;
[0040] Figure 5 It is a schematic diagram of the external read and write request processing flow in a disk array online capacity expansion method provided by the present invention;
[0041] Figure 6 It is a schematic diagram of a thread scheduling process for failed disk reconstruction in a disk array online capacity expansion method provided by the present invention;
[0042] Figure 7 The present invention provides a method for online expansion of a disk array. Figure 1 ;
[0043] Figure 8 The present invention provides a method for online expansion of a disk array. Figure 2 ;
[0044] Fig. 9 It is a structural schematic diagram of a disk array online capacity expansion device provided by the present invention;
[0045] Fig.10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] Combine the following Figure 1-Figure 9 The disk array online expansion method of the present invention is described as follows: Figure 1 As shown, the method comprises the steps of:
[0048] S110, determining a data storage setting after expansion based on the number of disks in the disk array after the newly added disk and the number of copies of data stored in the disk array, wherein in the data storage setting after expansion, the first data is stored in the target disk of the disk array, each copy of the second data has two copies of backup data, and the two copies of the backup data of each copy of the second data are respectively stored in the first disk group and the second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk;
[0049] S120, determining whether there is an unfinished failed disk reconstruction thread in the disk array, where the failed disk reconstruction thread is used to transfer data stored in the failed disk to a valid replacement disk;
[0050] S130: When there is no unfinished failed disk reconstruction thread in the disk array, redistribute and store the data stored in the disk array based on the expanded data storage setting.
[0051] The data storage setting is used to indicate the storage location of data in the disk array. In the method provided by the present invention, the disks in the disk array are divided into a target disk, a first disk group, and a second disk group. For example, all disks in a disk array including n disks are numbered from 0 to n-1, where the first disk is numbered 0, the second disk is numbered 1, and so on, until all the numbering of the n disks is completed, and the number 0 among the numbered disks is used as the target disk, and the disks from 1 to (n-1) are divided into two energy consumption groups, respectively named EnergyGroup1 and EnergyGroup2. In the method provided by the present invention, the data stored in the disk array is divided into first data and second data, the first data is not backed up, and the first data is stored in the target disk (for example, Figure 3 The second data has two backups (that is, there are two identical second data). The two backups of the second data are respectively allocated to the disks of the two energy consumption groups according to a certain rule (for example, Figure 3 disk1-4 in ). It can be seen that in Figure 3In the data layout example shown, the disks in any energy consumption group can be shut down and the availability of all data can be fully guaranteed. The energy saving ratio under this scheme can reach (n-1) / 2n, which can significantly reduce energy consumption.
[0052] While reasonably arranging the data, in order to ensure the reliability of the data in the system, the method provided by the present invention provides an encoding method for the storage location of each piece of data, so that when the number of disks and the number of data copies in the disk array are determined, the storage location of the data is uniquely determined, which is convenient for subsequent data search and reading and writing. Specifically, Figure 4 As shown, the process of determining the data storage setting in the disk array includes:
[0053] Calculate (n-id+j)mod(x);
[0054] When (n-id+j)mod(x) is equal to 0, the storage location of the data corresponding to the id value in the data storage setting is determined to be Disk(2x), Strip((j+1)mod(n-1)), where Disk(2x), Strip((j+1)mod(n-1)) represents the stripe storage area corresponding to the value of (j+1)mod(n-1) in the disk corresponding to the value of 2x;
[0055] When (n-id+j)mod(x) is not equal to 0, the storage location of the data corresponding to the id value in the data storage setting is determined to be Disk(x), Strip((j+1)mod(n-1)), where Disk(x), Strip((j+1)mod(n-1)) represents the stripe storage area corresponding to the value of (j+1)mod(n-1) in the disk corresponding to the value of x;
[0056] n is the number of disks in the disk array after the new disk is added, the value range of id is [1,2,3,…m], m is the number of copies of the second data in the disk array, the value range of j is [0,1,2,3,…m-2], and x is the number of disks in each disk group.
[0057] Furthermore, if Figure 2 As shown, the present invention provides a disk array online expansion method, which can provide energy-saving data storage layout and disk array online expansion. In order to realize that the disk array can add new disks to the system without affecting the normal use of users, there is no need to shut down and restart the system, back up data, or suspend applications, so as to ensure the normal operation of the system 24 hours a day, the disk array online expansion method provided by the present invention also includes the realization of online expansion, I / O conflict resolution and failed disk reconstruction process.
[0058] Specifically, online capacity expansion is the process of migrating data according to the data storage settings after capacity expansion. The data structure pointer of the newly added disk can be obtained through the hot_add_disk() function, which actually selects the disk from the hot spare disk as the added disk according to the command. The upper-layer configuration program obtains the disk data structure according to the disk descriptor and then passes it to the RAID layer. This layer calls the hot_add_disk() function to bind the disk to the array and sets it to a non-workingdisk state. After obtaining the disk data structure, the role of the disk in the array can be changed. The judgment of the capacity of the newly added disk is also performed in this function. Before applying for a new buffer, it is also necessary to ensure that the number of available disks is the specified number of the capacity expansion command. If a disk failure is found in the array, the reconstruction is given priority, that is, first determine whether there is an unfinished failed disk reconstruction thread. After there is no unfinished failed disk reconstruction thread, data migration is performed according to the new data storage settings.
[0059] The execution of the expansion thread starts from the logical sector 0, and a stripe buffer is requested every STRIPE_SECTORS, and the flag is set to STRIPE_EXPANDING, indicating that the stripe is a new array configuration stripe that needs to be filled with data. A total of CHUNKSIZE / STRIPE_SECTORS cycles are performed, and horizontally, data of the size of the CHUNKSIZE area is processed. The data buffer of the stripe is cleared and prepared to receive data read according to the old configuration. According to the data area processed by the expansion, the maximum sector numbers first_sector and last_sector from the disk are calculated. Initiate a read according to the old configuration for the data in this area, where STRIPE_SECTORS is the basic unit of disk data operation, and CHUNKSIZE is the array block size. First read the data according to the old configuration, and after all failed disk reconstruction threads are completed, read and write data according to the new data storage settings.
[0060] After the expansion thread is started but not completed, the disk array should have the ability to provide data reading and writing services to the outside to meet the user's normal I / O requests. Since data migration will occur during expansion, the location of the read and write sectors needs to be calculated based on the actual situation of the expansion. And the expansion reading and writing and the normal reading and writing requested by the user will access the same data block at the same time, so concurrent access will occur. In order to resolve the conflict with normal I / O and ensure the correctness of the data, the order of access must be guaranteed. In the method provided by the present invention, when the data stored in the disk array is redistributed and stored based on the data storage setting after expansion, the variable expand_progress is used to record the LBA value of the largest sector initiated by the expansion thread but not yet completed. The largest sector is the sector with the largest sector address in the current CHUNKSIZE data area, and the expand_lo variable is used to record the LBA value of the largest sector that has completed the expansion. If a read / write request is received from outside the disk array, the requested read / write sectors are mapped according to the new array configuration before the expansion is completed (i.e., the read / write sectors corresponding to the request are determined), and the sectors after that are mapped according to the old array configuration. The order of sectors is measured according to the logical block address LBA of the sectors. The larger the sector address, the later the sector is. The conflicting read / write is temporarily suspended.
[0061] The failed disk reconstruction process in the method provided by the present invention includes three parts: external request detection, reconstruction thread scheduling and reconstruction task execution. The external request detection part is responsible for capturing and analyzing the locality of user requests, and counting the read and write frequency of the area to determine the hot spot area. The reconstruction thread scheduling part is responsible for executing the scheduling to select the data unit to be handed over to the generated failed disk reconstruction thread, and put it into the FIFO reconstruction thread to wait for execution. The reconstruction task execution part is mainly responsible for obtaining the reconstruction task from the queue, executing the reconstruction data to the replacement disk, and updating the reconstruction unit bitmap at the same time.
[0062] Specifically, before determining whether there is an unfinished failed disk reconstruction thread in the disk array, the process includes:
[0063] receiving a read / write request for a failed disk area, where the failed disk area is the failed disk and a disk area in the same stripe as the failed disk among other disks;
[0064] If the number of hotspot areas in the disk array is not greater than the number of hotspot area descriptions, the disk area corresponding to the read / write request is taken as the hotspot area, and the number of read / write times of the disk area corresponding to the read / write request is increased by 1, and it is determined whether there is a target reconstruction thread. If not, a target reconstruction thread is established, and the target reconstruction thread is a failed disk reconstruction thread for the disk area corresponding to the read / write request;
[0065] If the number of hot spots in the disk array is greater than the number of hot spot descriptions, the read and write requests are suspended until the number of hot spots in the disk array is no greater than the number of hot spot descriptions.
[0066] After scheduling and executing the failed disk reconstruction thread based on the zone label corresponding to the failed disk reconstruction thread, the method further includes:
[0067] When the failed disk area corresponding to the failed disk reconstruction thread has been completely rebuilt, the hot spot area corresponding to the failed disk reconstruction thread is eliminated;
[0068] If the number of hot spots in the disk array is greater than a preset threshold after scheduling and executing the failed disk reconstruction thread for n consecutive times, some hot spots are eliminated from the current hot spots.
[0069] In external request detection, as the number of disks in the disk array increases, the probability of I / O requests falling on failed disks will gradually decrease. Write operations to other disks in the same stripe are also regarded as write requests to the failed disk of the stripe, and a judgment is added to fall after the default reconstruction thread area to reduce unnecessary status checks. In order to simplify the implementation, a fixed number of hot spot area resources are set in the present invention. When there are too many requests that need to occupy the hot spot area, these requests will be suspended until there are free hot spot area descriptors available. If the number of free available hot spot area descriptions is found to be less than a certain threshold after each scheduling, the part with the lowest priority will be eliminated. The priority of the hot spot area can be determined based on the number of read and write times of the hot spot area. The greater the number of read and write times, the higher the priority. The external request detection processing flow is as follows: Figure 5 As shown, Figure 5 The curunit in the command refers to the data unit or data area currently being read or written. Since each level has a different request processing method, the general process emphasizes the judgment of hot spots and the statistics of read and write times.
[0070] After determining whether there are unfinished failed disk reconstruction threads in the disk array, the following steps are performed:
[0071] When there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is scheduled for execution based on the area label corresponding to the failed disk reconstruction thread. The area label corresponding to the failed disk reconstruction thread reflects whether the disk area corresponding to the failed disk reconstruction thread is a hot spot area.
[0072] When there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is scheduled to determine the data unit of the failed disk corresponding to the failed disk reconstruction thread to be currently rebuilt. The data unit can be a single sector or multiple consecutive sectors. The data corresponding to the data unit is then read into the memory buffer so that it can be written to the replacement disk later.
[0073] Scheduling and executing the failed disk reconstruction thread based on the zone label corresponding to the failed disk reconstruction thread includes:
[0074] When the first condition or the second condition is met, the default scheduling thread is used to schedule and execute the failed disk reconstruction thread, otherwise the non-default scheduling thread is used to schedule and execute the failed disk reconstruction thread. The first condition is that there is no external workload when scheduling the failed disk reconstruction thread, and the second condition is that all the currently existing failed disk reconstruction threads have been completed or the currently existing failed disk reconstruction threads are in running state and no new hotspot area is created;
[0075] When the default scheduling thread is used to schedule and execute the failed disk reconstruction thread, the data stored in all data units corresponding to the failed disk reconstruction thread are transferred to the replacement disk at one time;
[0076] When a non-default scheduling thread is used to schedule and execute the failed disk reconstruction thread, the data unit corresponding to the failed disk reconstruction thread is reconstructed based on whether there is a hot spot area and whether there is a currently running failed disk reconstruction thread.
[0077] The most critical part of the reconstruction task is the scheduling selection. There are two situations when the default scheduling thread is called: ① No external workload is found during scheduling; ② All hotspot reconstruction threads have been completed or are in the completion state and no new hotspot areas are created. It is not necessary to mark the status of the unit reconstructed by the default thread. The scheduling function must ensure that the same data unit of the replacement disk is selected only once and all data units must be covered. In other words, when the default thread is used to rebuild the failed disk, the data of all data units in the failed disk are read into the cache at one time, and these data are written to a data unit of the replacement disk.
[0078] like Figure 6 As shown in the figure, when a non-default scheduling thread is used to rebuild a failed disk, first determine whether there is a hot spot area:
[0079] If there is no hotspot area, the data unit number of the Idle process that is being rebuilt is obtained. If it has been rebuilt, the next data unit number is obtained and it is determined whether it has been rebuilt. If the data unit number that has not been rebuilt is obtained, then the data unit number is determined to be the next task that needs to be rebuilt.
[0080] If there is a hotspot area, first determine whether there is a failed disk reconstruction thread in operation and the time slice is greater than 0:
[0081] If there is a failed disk reconstruction thread in the running state and the time slice is greater than 0, then find the unit that the thread needs to rebuild, and reduce the time slice by 1. If there is a time slice, the unit number of the data unit that the thread needs to rebuild is set as the next task that needs to be rebuilt, and the data unit is set to the Doing state (i.e., being rebuilt). After all the data units that need to be rebuilt of the thread are sent, the thread is set to completed. When the time slice is 0, the thread is paused.
[0082] If there is no failed disk reconstruction thread in the running state, then first try to find the highest priority suspended thread, that is, find the thread with the most read and write times in the corresponding hot spot area among the suspended failed disk reconstruction threads. If the highest priority suspended thread can be found, set the suspended thread state to running and assign a time slice, and select the first data unit in the data units that need to be rebuilt but have not been rebuilt in the process as the reconstruction task that needs to be executed currently. If the highest priority suspended thread cannot be found (for example, the priority of the suspended threads is the same), take the current reconstruction unit of the Idle process. If the unit has not been rebuilt and is not in the hot spot area, then take the next data unit that needs to be rebuilt.
[0083] After the unit number of the data unit to be rebuilt is determined by scheduling, it is handed over to the reconstruction task execution part for execution. The reconstruction task execution takes the data unit of the next task from the task queue, rather than the data units in sequence from the beginning to the end. In other words, the data units of the same disk may not be rebuilt continuously. During the reconstruction of the failed disk, there is a process corresponding to the failed disk, which is used to update the bitmap. The array controller creates processes for the corresponding disks. The algorithms of these processes are consistent, such as Figure 7 and Figure 8 As shown in the figure, each time a data unit is rebuilt, the data of the data unit is submitted to the buffer. When all the data units that need to be rebuilt of the failed disk are read into the memory, the process corresponding to the failed disk is terminated, and the replacement disk applies to the buffer management center for the next buffer unit filled with data, and writes the data in the buffer to the replacement disk. After the write operation is completed, the corresponding bit of the rebuilt data unit bitmap is updated. When all the data units in a hot spot area are rebuilt and the failed disk is rebuilt, all bits of the rebuilt unit bitmap are cleared, and the replacement disk resources are released. The process ends and prepares for the next round of expansion or releases the reconstruction unit bitmap space. When the next round of expansion is made, it is dynamically applied. The completion of reading and writing is notified in the form of function callback. Updating the bitmap and recycling the resources of the hot spot area that has been rebuilt does not affect the flow of tasks. Since there is no priority difference in read and write requests, the correctness of reading and writing is guaranteed by the buffer management center.
[0084] The disk array online capacity expansion device provided by the present invention is described below. The disk array online capacity expansion device described below and the disk array online capacity expansion method described above can be referred to each other. Fig. 9 As shown, the device comprises:
[0085] The storage setting module 910 is used to determine the data storage setting after the expansion based on the number of disks in the disk array after the newly added disk and the number of data copies stored in the disk array, wherein in the data storage setting after the expansion, the first data is stored in the target disk of the disk array, the second data has two backup data, and the two backup data of each second data are respectively stored in the first disk group and the second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk;
[0086] The reconstruction confirmation module 920 is used to determine whether there is an unfinished failed disk reconstruction thread in the disk array, and the failed disk reconstruction thread is used to transfer the data stored in the failed disk to a valid replacement disk;
[0087] The data migration module 930 is used to redistribute and store the data stored in the disk array based on the data storage setting after the expansion when there is no unfinished failed disk reconstruction thread in the disk array.
[0088] Fig.10 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.10 As shown, the electronic device may include: a processor (processor) 1010, a communication interface (Communications Interface) 1020, a memory (memory) 1030 and a communication bus 1040, wherein the processor 1010, the communication interface 1020, and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 can call the logic instructions in the memory 1030 to execute the online expansion method of the disk array, which includes: determining the data storage setting after the expansion based on the number of disks in the disk array after the new disk is added and the number of data stored in the disk array, wherein the first data in the data storage setting after the expansion is stored in the target disk of the disk array, and the second data has two backup data, and the two backup data of each second data are respectively stored in the first disk group and the second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk; determining whether there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is used to transfer the data stored in the failed disk to a valid replacement disk; and redistributing the data stored in the disk array based on the data storage setting after the expansion when there is no unfinished failed disk reconstruction thread in the disk array.
[0089] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0090] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the disk array online expansion method provided by the above methods, the method including: determining the data storage setting after expansion based on the number of disks in the disk array after the new disk is added and the number of data stored in the disk array, wherein the first data in the data storage setting after expansion is stored in the target disk of the disk array, and the second data has two backup data, and the two backup data of each second data are respectively stored in the first disk group and the second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk; determining whether there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is used to transfer the data stored in the failed disk to a valid replacement disk; and redistributing the data stored in the disk array based on the data storage setting after expansion when there is no unfinished failed disk reconstruction thread in the disk array.
[0091] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the disk array online expansion method provided by the above-mentioned methods, the method comprising: determining the data storage setting after expansion based on the number of disks in the disk array after the new disk is added and the number of data stored in the disk array, wherein in the data storage setting after expansion, the first data is stored in the target disk of the disk array, the second data has two backup data, and the two backup data of each second data are respectively stored in the first disk group and the second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk; determining whether there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is used to transfer the data stored in the failed disk to a valid replacement disk; and redistributing the data stored in the disk array based on the data storage setting after expansion when there is no unfinished failed disk reconstruction thread in the disk array.
[0092] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0093] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A disk array online capacity expansion method, characterized in that: include: Determine the data storage setting after the expansion based on the number of disks in the disk array after the newly added disk and the number of data copies stored in the disk array, wherein in the data storage setting after the expansion, the first data is stored in the target disk of the disk array, the second data has two backup data, and the two backup data of each copy of the second data are respectively stored in the first disk group and the second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk; Determine whether there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is used to transfer data stored in the failed disk to a valid replacement disk; When there is no unfinished failed disk reconstruction thread in the disk array, the data stored in the disk array is redistributed and stored based on the expanded data storage setting.
2. The disk array online expansion method according to claim 1, characterized in that: The method of determining the data storage setting after the expansion based on the number of disks in the disk array after the newly added disk and the number of data stored in the disk array includes: Calculate (n-id+j)mod(x); When (n-id+j)mod(x) is equal to 0, it is determined that the storage location of the data corresponding to the id value in the data storage setting is Disk(2x), Strip((j+1)mod(n-1)), where Disk(2x), Strip((j+1)mod(n-1)) represents the stripe storage area corresponding to the value of (j+1)mod(n-1) in the disk corresponding to the value of 2x; When (n-id+j)mod(x) is not equal to 0, it is determined that the storage location of the data corresponding to the id value in the data storage setting is Disk(x), Strip((j+1)mod(n-1)), where Disk(x), Strip((j+1)mod(n-1)) represents the stripe storage area corresponding to the value of (j+1)mod(n-1) in the disk corresponding to the value of x; n is the number of disks in the disk array after the new disk is added, the value range of id is [1,2,3,…m], m is the number of copies of the second data in the disk array, the value range of j is [0,1,2,3,…m-2], and x is the number of disks in each disk group.
3. The disk array online expansion method according to claim 1, characterized in that: Before determining whether there is an unfinished failed disk reconstruction thread in the disk array, the method includes: receiving a read / write request for a failed disk area, wherein the failed disk area is a failed disk and a disk area in the same stripe as the failed disk among other disks; If the number of hotspot areas in the disk array is not greater than the number of hotspot area descriptions, the disk area corresponding to the read / write request is used as a hotspot area, and the number of read / write times of the disk area corresponding to the read / write request is increased by 1, and it is determined whether there is a target reconstruction thread. If not, the target reconstruction thread is established, and the target reconstruction thread is the failed disk reconstruction thread for the disk area corresponding to the read / write request; If the number of the hot spots in the disk array is greater than the number of hot spots described, the read and write requests are suspended until the number of the hot spots in the disk array is no greater than the number of hot spots described.
4. The disk array online capacity expansion method according to claim 3, characterized in that: After determining whether there is an unfinished failed disk reconstruction thread in the disk array, the method includes: When there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is scheduled for execution based on the area tag corresponding to the failed disk reconstruction thread, and the area tag corresponding to the failed disk reconstruction thread reflects whether the disk area corresponding to the failed disk reconstruction thread is the hot spot area.
5. The disk array online capacity expansion method according to claim 4, characterized in that: The scheduling and executing of the failed disk reconstruction thread based on the area label corresponding to the failed disk reconstruction thread includes: When the first condition or the second condition is met, the default scheduling thread is used to schedule the failed disk reconstruction thread for execution, otherwise the non-default scheduling thread is used to schedule the failed disk reconstruction thread for execution, the first condition is that there is no external workload when scheduling the failed disk reconstruction thread, and the second condition is that the currently existing failed disk reconstruction threads have all been completed or the currently existing failed disk reconstruction threads are in a running state and no new hotspot area is created; When the default scheduling thread is used to schedule the failed disk reconstruction thread for execution, data stored in all data units corresponding to the failed disk reconstruction thread are transferred to the replacement disk at one time; When the non-default scheduling thread is used to schedule the failed disk reconstruction thread for execution, the data unit corresponding to the failed disk reconstruction thread is reconstructed based on whether the hotspot area currently exists and whether the failed disk reconstruction thread currently exists in a running state.
6. The disk array online capacity expansion method according to claim 5, characterized in that: After scheduling and executing the failed disk reconstruction thread based on the area label corresponding to the failed disk reconstruction thread, the method further includes: When the failed disk area corresponding to the failed disk reconstruction thread has been completely rebuilt, the hot spot area corresponding to the failed disk reconstruction thread is eliminated; If the number of the hot spots in the disk array is greater than a preset threshold after the failed disk reconstruction thread is scheduled to be executed n times in succession, some of the hot spots are eliminated from the current hot spots.
7. A disk array online expansion device, characterized in that: include: a layout setting module, used for determining a data storage setting after expansion based on the number of disks in the disk array after the newly added disk and the number of data copies stored in the disk array, wherein in the data storage setting after expansion, first data is stored in a target disk of the disk array, second data has two backup data, and the two backup data of each second data are respectively stored in a first disk group and a second disk group of the disk array, and the disks in the first disk group and the second disk group are the disks in the disk array except the target disk; A reconstruction confirmation module, used to determine whether there is an unfinished failed disk reconstruction thread in the disk array, the failed disk reconstruction thread is used to transfer data stored in the failed disk to a valid replacement disk; The data migration module is used to redistribute and store the data stored in the disk array based on the data storage setting after the expansion when there is no unfinished failed disk reconstruction thread in the disk array.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the online capacity expansion method for a disk array as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for online capacity expansion of a disk array as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for online capacity expansion of a disk array as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
On-line capacity-enlarging system and method for magnetic disc array
CN101226457A
Magnetic disc fault processing and data restructuring method in magnetic disc array system
CN101276302A
Disk array online capacity expansion method and device and computer readable storage medium
CN112130768A
Method and apparatus for reconstructing redundant arrays of independent drives, and device and medium
WO2023056728A1
Data processing method and apparatus, and electronic device
WO2023231281A1
