A storage area creation method, device and equipment

By managing disk objects using max-heap and red-black tree algorithms and constructing target storage areas, the problem of data imbalance between disks is solved, achieving efficient data storage and fast recovery, and improving the system's resource utilization and reliability.

CN119847440BActive Publication Date: 2026-04-14DAWNING INFORMATION IND (BEIJING) CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DAWNING INFORMATION IND (BEIJING) CO LTD
Filing Date
2024-12-30
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing technologies, storage area creation methods based on the CRUSH algorithm result in uneven data storage among hard drives, low resource utilization, and significant impact on business I/O during hard drive expansion and cluster map updates.

Method used

The algorithm uses a max-heap to select disk objects, manages disk objects through a red-black tree, constructs target storage areas, ensures balanced distribution of disk objects, performs fast deletion and virtual storage pool configuration in case of failure, and provides a unified segment structure interface.

Benefits of technology

It achieves balanced and rapid data storage switching between hard drives, improves system resource utilization, reduces the impact of hard drive expansion on business I/O, and ensures high data reliability and rapid recovery capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847440B_ABST
    Figure CN119847440B_ABST
Patent Text Reader

Abstract

The application relates to a storage area creation method, device and equipment, which comprises the following steps: obtaining a storage pool corresponding to a target storage area to be created; for each storage pool, the following process is circularly executed until a target hard disk object determined meets a first preset condition, and the target storage area is constructed based on each target hard disk object: a candidate hard disk located at the top of a large top stack obtained from the last cycle is taken out, and each hard disk is arranged in the large top stack according to the number of available hard disk objects; when it is determined that the candidate hard disk meets a second preset condition based on a hard disk frame corresponding to the candidate hard disk and hard disk frames corresponding to hard disks to which each target hard disk object belongs, a hard disk object is selected from the candidate hard disk as the target hard disk object; and the target position of the candidate hard disk in the large top stack is determined based on the number of available hard disk objects included in the current candidate hard disk, and the candidate hard disk is inserted, so that the data storage balance among the hard disks is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus and device for creating a storage area. Background Technology

[0002] In high-performance, high-reliability storage systems, using memory as the storage medium, employing a multi-replica approach, and combining it with fault-tolerant memory persistence techniques can achieve high-performance and high-reliability data storage at a relatively low cost. Specifically, during normal system operation, the system directly uses memory to achieve high performance. In the event of a system failure, the system persists the data in memory to the hard drive. Upon the next system startup, the data is read from the hard drive into memory, thus achieving high reliability.

[0003] In related technologies, when persisting data from system memory to hard disk, the storage area for data writing is typically determined by Ceph (a distributed file system). Specifically, Ceph records the location information of each hard disk in a cluster map (clustering heatmap) and, based on the cluster map and other information, uses the CRUSH (Controlled Replication UnderScalable Hashing) algorithm to determine storage areas at different fault domain levels for writing data from memory. However, because the CRUSH algorithm is relatively complex and is a decentralized algorithm, and the creation of storage areas is based on the cluster map, problems such as uneven data storage among hard disks exist. Summary of the Invention

[0004] This invention provides a method, apparatus, and device for creating storage areas to solve the problem of uneven data storage among hard drives.

[0005] In a first aspect, embodiments of this application provide a method for creating a storage region, the method comprising:

[0006] Obtain at least one storage pool corresponding to the target storage area to be created. The storage pool includes multiple hard disks, and each hard disk includes multiple hard disk objects.

[0007] For each storage pool, the following process is executed repeatedly until the identified target hard disk objects meet the first preset condition, and the target storage area is constructed based on the obtained target hard disk objects:

[0008] From the max-heap obtained in the previous loop, the candidate hard disk at the top of the heap is taken out; wherein, the hard disks included in the storage pool are arranged in the max-heap in order of the number of available hard disk objects included in the hard disk;

[0009] Based on the hard disk frame corresponding to the candidate hard disk and the reference hard disk frame corresponding to the hard disk to which each target hard disk object belongs, when it is determined that the candidate hard disk meets the second preset condition, a hard disk object is selected from the candidate hard disks as the target hard disk object.

[0010] Based on the number of available disk objects included in the current candidate disks, determine the target position of the candidate disk in the max heap, and insert the candidate disk into the target position.

[0011] The above method, when creating a target storage area, iteratively retrieves the candidate hard disk at the top of the heap for each storage pool. When it is determined that the corresponding hard disk frame meets the preset conditions, the target hard disk object is obtained from it, and the candidate hard disk is inserted back into the heap. The heap is then updated to facilitate subsequent operations. In this way, it can be ensured that the number of available hard disks among the candidate hard disks at the top of the heap is the largest, thus enabling priority selection from the hard disk with the largest number of available hard disk objects. In other words, it can quickly select the hard disk that meets the redundancy requirements from each hard disk, ensuring that each hard disk is in a balanced state.

[0012] In one possible implementation, the first preset condition includes at least one of the following:

[0013] The number of identified target objects reaches the first preset threshold;

[0014] The number of iterations reaches the second preset threshold;

[0015] In a max-heap, the number of available disk objects corresponding to the candidate disk at the top of the heap is zero.

[0016] In one possible implementation, based on the disk enclosure corresponding to the candidate hard drive and the disk enclosure corresponding to the hard drive to which each target hard drive object belongs, the candidate hard drive is determined to meet the second preset condition, including:

[0017] If the number of reference hard disk frames is less than a preset number, and none of the reference hard disk frames contain the hard disk frame corresponding to the candidate hard disk, then the candidate hard disk is determined to meet the second preset condition; or...

[0018] If the number of reference hard disk frames is not less than the preset number, the candidate hard disk is determined to meet the second preset condition.

[0019] The above method determines that the candidate hard disk meets the second preset condition when the number of reference hard disk frames reaches a preset number, or when the number of candidate hard disk frames does not reach the preset number and the candidate hard disk does not correspond to the reference hard disk frames. This ensures that the target hard disk objects are evenly distributed across multiple hard disk frames, thereby improving the balance of subsequent data storage.

[0020] In one possible implementation, when the target storage region corresponds to the first type, each target hard disk object in the target storage region belongs to multiple hard disks in multiple storage pools, and the method further includes:

[0021] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0022] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0023] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0024] If it is determined that the target storage area contains only one target hard disk object, and the storage pool corresponding to the hard disk to which the target hard disk object belongs is faulty, then the storage area corresponding to the hard disk of the target hard disk object is configured as a virtual storage pool.

[0025] The above method, by setting its corresponding first type of target storage area, ensures that the target storage area still exists even when the hard disk, hard disk enclosure, or storage pool corresponding to the target hard disk object fails. The setting of this target storage area meets the storage requirements of the data on which the system depends for normal operation and has high reliability requirements, thus providing high reliability for data storage.

[0026] In one possible implementation, when the target storage region corresponds to the second type, each target hard disk object in the target storage region belongs to multiple hard disks in the same storage pool, and the method further includes:

[0027] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0028] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0029] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete the target storage area.

[0030] The above method, by setting its corresponding second type of target storage area, ensures that the target storage area still exists when the hard disk or hard disk enclosure corresponding to the target hard disk object fails. The target storage area is only deleted when the storage pool fails. The setting of this target storage area satisfies the storage requirements of data that is strongly bound to the lifecycle of the storage pool.

[0031] In one possible implementation, before acquiring at least one storage pool corresponding to the target storage region to be created, the method further includes:

[0032] Create each storage pool, and for each storage pool, add the hard disk corresponding to the storage pool and each hard disk object in the hard disk to the storage pool;

[0033] Specifically, for any disk object, if it is determined based on the red-black tree algorithm that no disk object exists among the disk objects included in the storage pool, then that disk object is added to the storage pool.

[0034] The above method ensures that each hard disk object belongs to a single hard disk, effectively avoiding the multiple addition of a hard disk object to the storage pool, enabling fast verification of hard disk objects, and improving the accuracy of subsequent generation of target storage areas based on hard disk objects in the storage pool.

[0035] In one possible implementation, after constructing the target storage region, the method further includes:

[0036] Based on the target structure, the target storage area is encapsulated to obtain the segment structure corresponding to the target storage area;

[0037] The target structure is the structure used when encapsulating the storage area corresponding to memory, and the target structure includes: area type, number of replicas, and replica information; the area type corresponding to the target storage area is hard disk, the number of replicas is the number of hard disk objects included, and the replica information is the object information of each hard disk object.

[0038] The above method, by setting a unified segment structure for the storage areas of memory and hard disk, provides a unified read and write interface for hard disk and memory to the outside world. When persistent memory is unstable, the entry point of business requests can be quickly switched to the hard disk, ensuring that the business can quickly recover IO after a short (second-level) unavailability.

[0039] Secondly, embodiments of this application provide a storage area creation apparatus, the apparatus comprising:

[0040] The acquisition module is used to acquire at least one storage pool corresponding to the target storage area to be created. The storage pool includes multiple hard disks, and each hard disk includes multiple hard disk objects.

[0041] The construction module is used to iteratively execute the following process for each storage pool until the determined target hard disk objects meet the first preset condition, and then construct the target storage area based on the obtained target hard disk objects:

[0042] From the max-heap obtained in the previous loop, the candidate hard disk at the top of the heap is taken out; wherein, the hard disks included in the storage pool are arranged in the max-heap in order of the number of available hard disk objects included in the hard disk;

[0043] Based on the hard disk frame corresponding to the candidate hard disk and the reference hard disk frame corresponding to the hard disk to which each target hard disk object belongs, when it is determined that the candidate hard disk meets the second preset condition, a hard disk object is selected from the candidate hard disks as the target hard disk object.

[0044] Based on the number of available disk objects included in the current candidate disks, determine the target position of the candidate disk in the max heap, and insert the candidate disk into the target position.

[0045] In one possible implementation, the first preset condition includes at least one of the following:

[0046] The number of identified target objects reaches the first preset threshold;

[0047] The number of iterations reaches the second preset threshold;

[0048] In a max-heap, the number of available disk objects corresponding to the candidate disk at the top of the heap is zero.

[0049] In one possible implementation, the above-described building module is specifically used for:

[0050] If the number of reference hard disk frames is less than a preset number, and none of the reference hard disk frames contain the hard disk frame corresponding to the candidate hard disk, then the candidate hard disk is determined to meet the second preset condition; or...

[0051] If the number of reference hard disk frames is not less than the preset number, the candidate hard disk is determined to meet the second preset condition.

[0052] In one possible implementation, when the target storage area corresponds to the first type, each target hard disk object in the target storage area belongs to multiple hard disks in multiple storage pools. The above-mentioned device further includes a first management module, specifically used for:

[0053] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0054] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0055] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0056] If it is determined that the target storage area contains only one target hard disk object, and the storage pool corresponding to the hard disk to which the target hard disk object belongs is faulty, then the storage area corresponding to the hard disk of the target hard disk object is configured as a virtual storage pool.

[0057] In one possible implementation, when the target storage area corresponds to the second type, each target hard disk object in the target storage area belongs to multiple hard disks in the same storage pool. The above-mentioned device further includes a second management module, specifically used for:

[0058] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0059] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0060] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete the target storage area.

[0061] In one possible implementation, before acquiring at least one storage pool corresponding to the target storage region to be created, the acquisition module is further configured to:

[0062] Create each storage pool, and for each storage pool, add the hard disk corresponding to the storage pool and each hard disk object in the hard disk to the storage pool;

[0063] Specifically, for any hard disk object, if it is determined based on the red-black tree algorithm that no hard disk object exists among the storage objects included in the storage pool, then any hard disk object is added to the storage pool.

[0064] In one possible implementation, after constructing the target storage area, the aforementioned construction module is further used for:

[0065] Based on the target structure, the target storage area is encapsulated to obtain the segment structure corresponding to the target storage area;

[0066] The target structure is the structure used when encapsulating the storage area corresponding to memory, and the target structure includes: area type, number of replicas, and replica information; the area type corresponding to the target storage area is hard disk, the number of replicas is the number of hard disk objects included, and the replica information is the object information of each hard disk object.

[0067] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the memory area creation method.

[0068] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the storage area creation method described above.

[0069] Fifthly, embodiments of this application provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the memory access device to perform the steps in the storage area creation method described above in this application.

[0070] For each of the aspects mentioned above (second to fifth) and the technical effects that each aspect may achieve, please refer to the above description of the technical effects that can be achieved for the first aspect or the various possible solutions in the first aspect. It will not be repeated here. Attached Figure Description

[0071] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0072] Figure 1 A schematic diagram illustrating a method for creating a storage area according to an embodiment of this application;

[0073] Figure 2 A schematic diagram of a storage pool and hardware frame provided in an embodiment of this application;

[0074] Figure 3 A schematic diagram illustrating an example of creating a single-pool storage region according to an embodiment of this application;

[0075] Figure 4 A schematic diagram illustrating an example of creating a cross-pool storage region as provided in an embodiment of this application;

[0076] Figure 5 A schematic diagram of a storage area creation apparatus provided in an embodiment of this application;

[0077] Figure 6 A schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0078] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0079] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The term "multiple" in this application can mean at least two, for example, two, three, or more, and the embodiments of this application do not impose limitations.

[0080] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These embodiments should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description. It should be noted that in the embodiments of this application, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solutions of this application, and do not imply that the applicant has already used or necessarily used such solutions.

[0081] The acquisition, transmission, storage, and use of data in this application all comply with the requirements of relevant national laws and regulations.

[0082] To facilitate a better understanding of the technical solutions provided in the embodiments of this application by those skilled in the art, the following is a brief explanation of the relevant technical terms:

[0083] (1) CRUSH (Controlled Replication Under Scalable Hashing): A data distribution algorithm based on hash. It takes the unique identifier of the data, the topology of the current storage cluster, and the data backup strategy as inputs to CRUSH. It can obtain the location of the underlying storage device where the data is located anytime and anywhere through calculation and communicate directly with it, thereby avoiding table lookup operations and achieving decentralization and high concurrency.

[0084] (2) Hard disk enclosure: The physical location of the hard disk.

[0085] (3) Storage pool: The logical location of the hard disk, which serves as a logical storage space to provide services to the business.

[0086] (4) Disk object: The smallest storage unit on the disk with a fixed storage space, identified by the physical disk ID and offset.

[0087] (5) Memory segment (i.e., the storage area corresponding to memory): provides the smallest storage unit based on memory to the outside world.

[0088] (6) Disk segment (i.e. target storage area): provides the smallest storage unit based on disk to the outside world. It consists of multiple copies of disk objects on multiple disks and carries disk object information.

[0089] In high-performance, high-reliability storage systems, using memory as the storage medium, employing a multi-replica approach, and combining it with fault-tolerant memory persistence technologies (such as PMem media and batteries) can achieve high-performance and high-reliability data storage at a relatively low cost. Specifically, during normal system operation, the system directly uses memory to achieve high performance. In the event of a system failure (such as a system crash), the system persists the data in memory to the hard drive. Upon the next system startup, the data is read from the hard drive and loaded into memory, thus achieving high reliability.

[0090] The above solution balances cost and high performance, ensuring no data loss during normal or abnormal system operation. However, this solution currently has the following two problems:

[0091] 1. Memory-based high-performance storage systems are more expensive than ordinary hard drives. In different application scenarios, businesses expect to be able to flexibly select between memory and hard drives and switch between them smoothly. To meet such needs, a hard drive management architecture that supports high data reliability and fast allocation is required so that businesses can apply for and use data on demand in scenarios where high performance is not the priority.

[0092] 2. When persistent memory is unstable, high-performance memory-based storage systems need to quickly switch the entry point of business requests to the hard disk to ensure that the business can quickly recover IO (Input / Output) after a short (second-level) period of unavailability. In this scenario, it is necessary to keep the management of the hard disk as simple as possible, and during business use, the management and read / write services provided by the two storage media (memory and hard disk) should be consistent.

[0093] In related technologies, when persisting data in system memory to hard disk, the storage area (PG) where the data is written is usually determined by Ceph (distributed file system). Specifically, Ceph records the location information of each hard disk in a cluster map (cluster heatmap), and based on information such as the cluster map and cluster rules, it uses the CRUSH (Controlled Replication Under Scalable Hashing) algorithm to determine OSDs (Object-based Storage, corresponding to hard disks) at different fault domain levels to store PGs for writing data from memory.

[0094] While the above methods solve the problems of single point of failure, performance bottlenecks, and lack of scalability in centralized architectures, the CRUSH algorithm is relatively complex and is a decentralized algorithm. The creation of storage areas is based on the cluster map, which leads to problems such as uneven data storage among hard drives, resulting in low resource utilization of the entire system. At the same time, since OSD expansion and cluster map updates trigger data synchronization across the entire system, it has a significant impact on business I / O.

[0095] To overcome the above problems, this application provides a storage area creation method. This method uses a hard disk segment (i.e., the target storage area) as the storage unit externally, which is compatible with the memory storage unit. Internally, it uses a hard disk object as the smallest storage unit, which achieves high data reliability and quickly and evenly selects hard disk objects to create the target storage area. Thus, when the business specifies hard disk storage for data or persistent memory is unstable, the business can quickly switch to this software management system.

[0096] The present application will now be described in further detail with reference to the accompanying drawings. See also: Figure 1 The diagram shown is a flowchart of a storage area creation method provided in an embodiment of this application. The specific implementation process of this method is as follows:

[0097] Step S101: Obtain at least one storage pool corresponding to the target storage region to be created.

[0098] Each storage pool contains multiple hard drives, and each hard drive contains multiple hard drive objects; for example... Figure 2 As shown, the storage device includes multiple storage pools and multiple disk enclosures. Each disk enclosure includes multiple disks, such as... Figure 2 As shown, disk frame 1 includes disks 1, 5, 9, and 13 (the number of disks here is just an example). Each storage pool includes multiple disks, such as... Figure 2 Storage pool 0 shown includes hard drives 1 through 4 (this number is just an example), and the hard drives in each storage pool may belong to different hard drive enclosures, such as... Figure 2 Storage pool 1 includes hard disk 1 belonging to hard disk frame 1, hard disk 2 belonging to hard disk frame 2, hard disk 3 belonging to hard disk frame 3, and hard disk 4 belonging to hard disk frame 4.

[0099] In one possible implementation, before acquiring at least one of the aforementioned storage pools, a storage pool creation process also needs to be performed, specifically:

[0100] Create each storage pool, and for each storage pool, add the hard disk corresponding to the storage pool and each hard disk object in the hard disk to the storage pool;

[0101] Specifically, for any disk object, if it is determined based on the red-black tree algorithm that no disk object exists among the disk objects included in the storage pool, then that disk object is added to the storage pool.

[0102] In some embodiments, before creating the storage area corresponding to the hard disk, each storage pool needs to be created first. Specifically, when creating the storage pool, it is necessary to ensure that each hard disk object belongs to a single hard disk, that is, to avoid adding a hard disk object to the storage pool multiple times. To achieve this effect, in this embodiment, for each storage pool, when injecting the hard disk and hard disk object (the correspondence is preset by the user based on requirements) corresponding to the storage pool into the storage pool, each hard disk uses a red-black tree to manage the hard disk object. That is, when a hard disk object is injected, it is first checked whether the hard disk object already exists on the hard disk. If the hard disk object does not exist, the subsequent injection operation is performed. If the hard disk object exists, the injection of the hard disk object is not performed. At the same time, a corresponding error log can be generated to record the information of the current hard disk object being injected repeatedly, so that the user can view it. Since the red-black tree algorithm is based on binary fractions to realize the association of hard disk objects, the time complexity of this operation is O(logn).

[0103] The above operations ensure that each hard disk object belongs to a single hard disk, effectively avoiding the multiple addition of a hard disk object to the storage pool, enabling fast verification of hard disk objects, and improving the accuracy of subsequent generation of target storage areas based on hard disk objects in the storage pool. At the same time, since this application uses the red-black tree algorithm for hard disk object management, the time complexity of this operation is O(logn). Therefore, the overall performance can meet the needs of target storage area allocation and release in scenarios where BBU (Building Baseband Unit) cannot be used.

[0104] In one possible implementation, to provide different levels of reliability for services, this application provides two types (i.e., a first type and a second type) of target storage regions. When the target storage region corresponds to the first type, each target hard disk object in the target storage region belongs to multiple hard disks in multiple storage pools, that is, the target storage region includes multiple hard disk objects across storage pools. When the target storage region corresponds to the second type, each target hard disk object in the target storage region belongs to multiple hard disks in the same storage pool, that is, the target storage region includes multiple hard disk objects in a single storage pool. The first type of target storage region is suitable for data on which the normal operation of the storage system depends and which has high reliability requirements, while the second type of target storage region is suitable for data whose storage lifecycle is strongly bound to the storage pool.

[0105] In specific implementation, when the target storage area in step S101 is of the first type, the number of storage pools obtained is the number of storage pools included in the storage system, that is, each storage pool included in the storage system is taken as the storage pool corresponding to the target storage area.

[0106] It should be noted that for the first type of target storage area, if a new storage pool is created after the target storage area is created, the number of storage pools corresponding to the target storage area will be updated. That is, the target storage area will be recreated once to ensure that the target storage area includes the disk objects (i.e., copies) in each storage pool.

[0107] When the target storage area in step S101 is of type two, the number of storage pools obtained is 1, meaning the target storage area corresponds to only one storage pool. It should be noted that, in this case, the storage pool corresponding to the target storage area needs to be pre-configured by the user based on their needs.

[0108] Step S102: For each storage pool, repeat the steps described in S1021-1023 until the determined target hard disk object meets the first preset condition, and construct the target storage area based on the obtained target hard disk objects:

[0109] In one possible implementation, the first preset condition includes at least one of the following:

[0110] The number of identified target hard disk objects reaches the first preset threshold;

[0111] The number of iterations reaches the second preset threshold;

[0112] In a max-heap, the number of available disk objects corresponding to the candidate disk at the top of the heap is zero.

[0113] In some embodiments, different first preset thresholds and second preset thresholds can be set for different types of target storage regions and different storage pools. In specific implementations, the values ​​of the first preset threshold and the second preset threshold can be set based on requirements, and no restrictions are imposed in this application embodiment.

[0114] In practice, the aforementioned first preset threshold refers to the first preset threshold of the target hard disk objects corresponding to the current storage pool. The sum of the first preset thresholds of the target hard disk objects corresponding to each storage pool is the preset total number of target hard disk objects included in the target storage area. The preset total number can be set to the maximum value between the number of storage pools and the preset number threshold (this value can be set based on requirements, preferably 4).

[0115] It should be noted that if the total number mentioned above refers to the number of storage pools, then the first preset threshold for each storage pool is 1. If the total number mentioned above refers to a preset threshold, meaning the number of storage pools is less than the preset threshold, then at least one of the first preset thresholds for each storage pool will not be 1. If one storage pool cannot meet the requirement of its corresponding first preset threshold, then the first preset thresholds for the other storage pools need to be modified accordingly to meet the requirement of the total number of target storage pools.

[0116] For example, assuming the number of storage pools is 3, including storage pool 1, storage pool 2 and storage pool 3, and the preset number threshold is 4, then when setting the first preset threshold for each storage pool, it can be set as follows: the first preset threshold for storage pool 1 is 2, the first preset threshold for storage pool 1 is 1, and the first preset threshold for storage pool 2 is 1.

[0117] Step S1021: Take out the candidate hard disk located at the top of the max-heap obtained in the previous loop;

[0118] The storage pool contains hard disks arranged in a top-heap according to the number of available hard disk objects contained in each disk.

[0119] In some embodiments, each storage pool is provided with a corresponding max-heap, which includes multiple hard disks (i.e., multiple hard disks included in the storage pool) arranged in sequence. The multiple hard disks are sorted in sequence according to the number of available hard disk objects. The available hard disk objects refer to unallocated hard disk objects. The sorting is performed in descending order of available hard disk objects. That is, the candidate hard disk at the top of the heap is the hard disk with the most available hard disk objects among the hard disks in the max-heap.

[0120] It should be noted that after the candidate hard disk at the top of the max-heap is removed, the max-heap will no longer contain that candidate hard disk, and the hard disks in the max-heap will be reordered.

[0121] In some embodiments, to ensure the real-time accuracy of the max heap, this application may periodically update the max heap corresponding to the storage pool based on the status of the disk objects included in each disk in the current storage pool. Specifically, the update period can be set according to requirements. For example, the period can be set to a fixed value or a dynamic value and can be modified in real time according to requirements.

[0122] In this embodiment of the application, the above method can ensure that the number of available hard disks among the candidate hard disks at the top of the heap is the largest. This ensures that when selecting a target hard disk object, the selection will be prioritized from the hard disk with the largest number of available hard disk objects, thereby ensuring data balance.

[0123] In some embodiments, before retrieving the candidate hard disk at the top of the max-heap obtained from the previous loop, it is necessary to determine whether the candidate hard disk includes any usable hard disk objects. If it is determined that no usable hard disk objects are included, then it can be determined that all hard disks in the max-heap (i.e., the storage pool) are unusable. In this case, the loop ends directly, i.e., as mentioned in the first preset condition above, the number of usable hard disk objects corresponding to the candidate hard disk at the top of the max-heap is zero. Since only one judgment operation is performed before the loop ends, the time complexity of this operation is O(1). If it is determined that there are usable hard disk objects included, then the candidate hard disk at the top of the max-heap is retrieved. In this case, since the max-heap manages hard disks in a tree structure, the time complexity of this operation is O(logn).

[0124] Step S1022: Based on the hard disk frame corresponding to the candidate hard disk and the reference hard disk frame corresponding to the hard disk to which each target hard disk object belongs, when it is determined that the candidate hard disk meets the second preset condition, a hard disk object is selected from the candidate hard disks as the target hard disk object.

[0125] In one possible implementation, the process of determining whether a candidate hard drive meets the second preset condition based on the hard drive enclosure corresponding to the candidate hard drive and the hard drive enclosure corresponding to the hard drive to which each target hard drive object belongs can be as follows:

[0126] If the number of reference hard disk frames is less than a preset number, and none of the reference hard disk frames contain the hard disk frame corresponding to the candidate hard disk, then the candidate hard disk is determined to meet the second preset condition; or...

[0127] If the number of reference hard disk frames is not less than the preset number, the candidate hard disk is determined to meet the second preset condition.

[0128] In some embodiments, this application pre-sets a minimum number of hard disk frames, that is, each target hard disk object in the target storage area needs to be distributed within a minimum number of hard disk frames. In specific implementations, the preset number can be set based on requirements. For example, it can be set to: minus 2 based on the number of target hard disk objects in the target storage area (this value can be set based on requirements), or a certain preset value. For example, when the target storage area is of the first type, the preset number is set to 3, and when the target storage area is of the second type, the preset number is set to 2.

[0129] In some embodiments, during each loop, after the candidate hard disk at the top of the heap is taken out from the max heap, it is necessary to determine whether the number of hard disk frames (i.e., reference hard disk frames) corresponding to the hard disks to which each target hard disk object belongs has reached a preset number. If it has reached the preset number, it is not necessary to consider the hard disk frames corresponding to the candidate hard disks. If it has not reached the preset number, it is necessary to ensure that the hard disk frames corresponding to the candidate hard disks do not belong to the reference hard disk frames.

[0130] In practice, if the candidate hard drives do not meet the second preset condition, subsequent operations will not be performed, the current loop will end, and the next loop will begin. It should be noted that at this time, the selected candidate hard drives will not be inserted into the max-heap. That is, in the next loop, the selected candidate hard drives will be updated, thereby ensuring that the hard drive enclosures corresponding to the determined target hard drive object meet the above-mentioned preset number requirement.

[0131] In some embodiments, when a candidate hard disk meets a second preset condition, a hard disk object (i.e., an available hard disk) is randomly selected from the candidate hard disks as the target hard disk object. In practice, since each hard disk is managed based on a red-black tree algorithm, the time complexity of this operation is O(logn).

[0132] Step S1023: Based on the number of available hard disk objects included in the current candidate hard disk, determine the target position of the candidate hard disk in the max heap, and insert the candidate hard disk into the target position.

[0133] In this embodiment, when creating the target storage area, when selecting a hard disk object on a hard disk as a copy of the storage area (i.e., the target hard disk object), it is necessary to ensure that only one hard disk object is selected on each hard disk. To achieve this effect, in this embodiment, before inserting the candidate hard disk into the target position, the candidate hard disk needs to be marked to indicate that the target hard disk object has been selected from the candidate hard disk. At this time, in step S1021 above, before taking the hard disk at the top of the heap from the max-heap obtained in the previous loop, it is necessary to determine whether the hard disk has been marked. If it has not been marked, the subsequent steps are executed. If it has been marked, the hard disk at the next position after the top of the max-heap is taken as the candidate hard disk used when executing steps S1022-S1023.

[0134] In one possible implementation, after constructing the target storage region, the embodiments of this application further perform the following operations:

[0135] Based on the target structure, the target storage area is encapsulated to obtain the segment structure corresponding to the target storage area;

[0136] The target structure mentioned above is the structure used when encapsulating the storage area corresponding to memory, and the target structure includes: area type, number of replicas, and replica information; the area type corresponding to the target storage area is hard disk, the number of replicas is the number of hard disk objects included, and the replica information is the object information of each hard disk object.

[0137] In some embodiments, the storage areas corresponding to the hard disk and the storage areas corresponding to the memory are encapsulated into a unified segment structure. The structure of this segment structure includes: the number of replicas, the region type (memory or hard disk), and replica information.

[0138] Specifically, for the storage area corresponding to the hard drive, its replica information consists of hard drive object information (in some embodiments, it can be composed of hard drive ID and offset), the number of replicas is the number of hard drive objects included, and the area type is hard drive. In response to a user's request for business read / write operations, the request carries a segment structure pointer, the starting offset of the read / write area, and the length of the read / write area. The pointer is used to identify the hard drive's ID and other information. The underlying hard drive module's encapsulated interface is called, and the hard drive's ID and offset are input to directly access the hard drive.

[0139] In some embodiments, the target storage area uses strong consistency write. When all hard drives have been successfully written, a success is returned to the business. If any copy is successfully read, a success is returned to the business.

[0140] For the storage region corresponding to memory, its replica information is memory location information, the number of replicas is the number of memory units included, and the region type is memory. In response to user requests for business read / write operations, the corresponding memory block data is read or written directly using the memory location information carried in the request.

[0141] This application embodiment sets a unified segment structure for the storage areas of memory and hard disk, and provides a unified read and write interface for hard disk and memory. When persistent memory is unstable, the entry point of business requests can be quickly switched to the hard disk, ensuring that the business can quickly recover IO after a short (second-level) unavailability.

[0142] In some embodiments, this application supports the fast deletion of failed hard drives based on a max-heap when constructing the target storage area. Specifically, the max-heap is implemented using arrays (i.e., array indices) corresponding to each hard drive, with each array identifying the position of the corresponding hard drive in the max-heap. When a hard drive fails, it can be quickly swapped to the tail of the max-heap based on its array, and then a max-heap update operation is performed. The time complexity of this operation is O(logn).

[0143] In one possible implementation, when the target storage region corresponds to the first type, the following operations are also performed in this embodiment:

[0144] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0145] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0146] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0147] If it is determined that the target storage area contains only one target hard disk object, and the storage pool corresponding to the hard disk to which the target hard disk object belongs is faulty, then the storage area corresponding to the hard disk of the target hard disk object is configured as a virtual storage pool.

[0148] In some embodiments, when the target storage region is of the first type, i.e., a cross-storage pool type, the failure of any storage pool, disk enclosure, or disk corresponding to each target disk object in the target storage pool will not affect the lifecycle of the target storage region. When the storage pool corresponding to the disk to which any target disk object belongs in the target storage region fails, that target disk object is deleted from the target storage region. When the target storage region contains only one target disk object, and the storage pool corresponding to the disk to which that target disk object belongs fails, the target storage pool will be switched to a virtual storage pool to continue existing.

[0149] In one possible implementation, when the target storage region corresponds to the second type, the following operations are also performed in this embodiment:

[0150] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0151] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0152] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete the target storage area.

[0153] In some embodiments, when the target storage area is of the second type, namely the single storage pool type, the failure of any hard disk enclosure or hard disk corresponding to each target hard disk object in the target storage pool will not affect the lifecycle of the target storage area. However, the lifecycle of the storage pool corresponding to the target hard disk is consistent with the lifecycle of the target UCUN output area. When the storage pool corresponding to the hard disk to which the target hard disk object belongs in the target storage area fails or is deleted, the target storage pool will be deleted or become inaccessible.

[0154] The following combination Figure 3 The process of creating a target storage region of the second type (i.e., single pool) is illustrated in detail with a specific example. The process includes the following steps:

[0155] Step S301: Obtain the storage pool corresponding to the target storage area to be created;

[0156] Step S302: Determine whether the storage pool is in a usable state. If yes, proceed to step S303; otherwise, proceed to step S301.

[0157] If a storage pool is currently available for allocation and includes available hard drives, then the storage pool is determined to be in a usable state; otherwise, the storage pool is determined to be in an unusable state.

[0158] Step S303: Remove the candidate hard disk located at the top of the heap from the max heap corresponding to the storage pool;

[0159] Step S304: Determine whether the candidate hard disk is in a usable state. If yes, proceed to step S305; otherwise, proceed to step S303.

[0160] Specifically, if a candidate hard disk is currently allocable and an available hard disk object exists, then the candidate hard disk is determined to be in a usable state; otherwise, the candidate hard disk is determined to be in an unusable state.

[0161] Step S305: Based on the disk frame corresponding to the candidate hard disk and the reference disk frame corresponding to the hard disk to which each target hard disk object belongs, determine whether the candidate hard disk meets the second preset condition; if yes, proceed to step S306; otherwise, proceed to step S303.

[0162] The second preset condition is: the number of each reference hard disk frame is less than a preset number, and each reference hard disk frame does not include the hard disk frame corresponding to the candidate hard disk; or, the number of each reference hard disk frame is not less than the preset number.

[0163] Step S306: Select a hard disk object from the candidate hard disks as the target hard disk object;

[0164] Step S307: Based on the number of available hard disk objects included in the current candidate hard disks, insert the selected hard disk into the corresponding position in the max heap.

[0165] Step S308: Determine whether the loop meets the first preset condition. If yes, proceed to step S309; ​​otherwise, return to step S303.

[0166] Step S309: Construct the target storage area based on each target hard disk object.

[0167] The following combination Figure 4 The creation process of the first type (i.e., cross-pool) target storage region is illustrated in detail with a specific example. The process includes the following steps:

[0168] Step S401: Obtain each storage pool corresponding to the target storage area to be created;

[0169] Step S402: For a storage pool, determine whether the storage pool is in a usable state. If yes, proceed to step S403; otherwise, proceed to step S401.

[0170] If a storage pool is currently available for allocation and includes available hard drives, then the storage pool is determined to be in a usable state; otherwise, the storage pool is determined to be in an unusable state.

[0171] Step S403: Remove the candidate hard disk located at the top of the heap from the max heap corresponding to the storage pool;

[0172] Step S404: Determine whether the candidate hard disk is in a usable state. If yes, proceed to step S405; otherwise, proceed to step S403.

[0173] Specifically, if a candidate hard disk is currently allocable and an available hard disk object exists, then the candidate hard disk is determined to be in a usable state; otherwise, the candidate hard disk is determined to be in an unusable state.

[0174] Step S405: Based on the disk frame corresponding to the candidate hard disk and the reference disk frame corresponding to the hard disk to which each target hard disk object belongs, determine whether the candidate hard disk meets the second preset condition; if yes, proceed to step S406; otherwise, proceed to step S403.

[0175] The second preset condition is: the number of each reference hard disk frame is less than a preset number, and each reference hard disk frame does not include the hard disk frame corresponding to the candidate hard disk; or, the number of each reference hard disk frame is not less than the preset number.

[0176] Step S406: Select a hard disk object from the candidate hard disks as the target hard disk object;

[0177] Step S407: Based on the number of available hard disk objects included in the current candidate hard disks, insert the selected hard disk into the corresponding position in the max heap.

[0178] Step S408: Determine whether the loop meets the first preset condition. If yes, proceed to step S409; otherwise, return to step S403.

[0179] Step S409: Determine whether each storage pool has been traversed and whether the number of target hard disk objects obtained has reached the preset total number. If yes, proceed to step S410; otherwise, proceed to step S402.

[0180] It should be noted that when returning to the execution step S402, the aforementioned storage pool refers to the next storage pool after the current storage pool.

[0181] Step S410: Construct the target storage area based on each target hard disk object.

[0182] Based on the same inventive concept, this application also provides a storage area creation device, see [link to relevant documentation]. Figure 5 The device includes:

[0183] The acquisition module 501 is used to acquire at least one storage pool corresponding to the target storage area to be created, wherein the storage pool includes multiple hard disks, and each hard disk includes multiple hard disk objects.

[0184] The construction module 502 includes a first submodule 5021, a second submodule 5022, and a third submodule 5023, which are used to repeatedly execute the following process for each storage pool until the determined target hard disk object meets the first preset condition, and construct the above-mentioned target storage area based on the obtained target hard disk objects:

[0185] Through the first submodule 5021, the candidate hard disk located at the top of the heap is taken out from the max heap obtained in the previous loop; wherein, the hard disks included in the above storage pool are arranged in the above max heap in order of the number of available hard disk objects included in the hard disk;

[0186] Through the second submodule 5022, based on the hard disk frame corresponding to the above candidate hard disks and the reference hard disk frame corresponding to the hard disk to which each target hard disk object belongs, when it is determined that the above candidate hard disks meet the second preset condition, a hard disk object is selected from the above candidate hard disks as the target hard disk object.

[0187] The third submodule 5023 determines the target position of the candidate hard disk in the max heap based on the number of available hard disk objects included in the current candidate hard disk, and inserts the candidate hard disk into the target position.

[0188] In one possible implementation, the first preset condition includes at least one of the following:

[0189] The number of identified target objects reaches the first preset threshold;

[0190] The number of iterations reaches the second preset threshold;

[0191] In a max-heap, the number of available disk objects corresponding to the candidate disk at the top of the heap is zero.

[0192] In one possible implementation, the second submodule 5022 is specifically used for:

[0193] If the number of reference hard disk frames is less than a preset number, and none of the reference hard disk frames contain the hard disk frame corresponding to the candidate hard disk, then the candidate hard disk is determined to meet the second preset condition; or...

[0194] If the number of reference hard disk frames is not less than the preset number, the candidate hard disk is determined to meet the second preset condition.

[0195] In one possible implementation, when the target storage area corresponds to the first type, each target hard disk object in the target storage area belongs to multiple hard disks in multiple storage pools. The above-mentioned device further includes a first management module, specifically used for:

[0196] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0197] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0198] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0199] If it is determined that the target storage area contains only one target hard disk object, and the storage pool corresponding to the hard disk to which the target hard disk object belongs is faulty, then the storage area corresponding to the hard disk of the target hard disk object is configured as a virtual storage pool.

[0200] In one possible implementation, when the target storage area corresponds to the second type, each target hard disk object in the target storage area belongs to multiple hard disks in the same storage pool. The above-mentioned device further includes a second management module, specifically used for:

[0201] If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete any target hard drive object from the target storage area;

[0202] If it is determined that the hard disk enclosure corresponding to any target hard disk object in the target storage area is faulty, delete any target hard disk object from the target storage area.

[0203] If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, delete the target storage area.

[0204] In one possible implementation, before acquiring at least one storage pool corresponding to the target storage region to be created, the acquisition module 501 is further configured to:

[0205] Create each storage pool, and for each storage pool, add the hard disk corresponding to the storage pool and each hard disk object in the hard disk to the storage pool;

[0206] Specifically, for any hard disk object, if it is determined based on the red-black tree algorithm that no hard disk object exists among the storage objects included in the storage pool, then any hard disk object is added to the storage pool.

[0207] In one possible implementation, after constructing the target storage area, the construction module 502 is further configured to:

[0208] Based on the target structure, the target storage area is encapsulated to obtain the segment structure corresponding to the target storage area;

[0209] The target structure is the structure used when encapsulating the storage area corresponding to memory, and the target structure includes: area type, number of replicas, and replica information; the area type corresponding to the target storage area is hard disk, the number of replicas is the number of hard disk objects included, and the replica information is the object information of each hard disk object.

[0210] Based on the same inventive concept, this application also provides an electronic device that can realize the function of the aforementioned storage area creation device. (Refer to...) Figure 6 The electronic device includes:

[0211] At least one processor 601 and a memory 602 connected to at least one processor 601. In this embodiment, the specific connection medium between the processor 601 and the memory 602 is not limited. Figure 6 The example shown is the connection between processor 601 and memory 602 via bus 600. Bus 600 is... Figure 6 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The 600 bus can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 6 The term is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 601 can also be called a controller; there is no restriction on the name.

[0212] In this embodiment, memory 602 stores instructions executable by at least one processor 601. By executing the instructions stored in memory 602, at least one processor 601 can perform the memory region creation method described above. Processor 601 can implement... Figure 5 The functions of each module in the device shown.

[0213] The processor 601 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 602 and calling data stored in memory 602, the processor can perform various functions and process data, thereby monitoring the device as a whole.

[0214] In one possible design, processor 601 may include one or more processing units. Processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 601. In some embodiments, processor 601 and memory 602 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.

[0215] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the storage area creation method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.

[0216] Memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 602 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 602 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 602 may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0217] By designing and programming the processor 601, the code corresponding to the application anomaly detection method described in the foregoing embodiments can be embedded into the chip, thereby enabling the chip to execute the code during runtime. Figure 1 The steps of the storage area creation method in the illustrated embodiment are described. How to design and program the processor 601 is a technique well-known to those skilled in the art and will not be elaborated upon here.

[0218] This application also provides a computer-readable storage medium storing computer-executable instructions required to execute the processor, including a program required to execute the processor.

[0219] In some possible implementations, various aspects of the storage area creation method provided in this application can also be implemented as a program product, which includes program code. When the program product is run on an electronic device, the program code is used to cause the electronic device to perform the steps in the storage area creation method according to the various exemplary embodiments of this application described above.

[0220] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0221] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0222] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0223] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0224] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0225] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for creating a storage area, characterized in that, The method includes: Obtain at least one storage pool corresponding to the target storage area to be created, wherein the storage pool includes multiple hard disks, and each hard disk includes multiple hard disk objects; For each storage pool, the following process is executed cyclically until the determined target hard disk objects meet the first preset condition, and the target storage area is constructed based on the obtained target hard disk objects: From the max heap obtained in the previous loop, the candidate hard disk that is ranked first among the unmarked hard disks is taken out; wherein, the hard disks included in the storage pool are arranged in the max heap according to the number of available hard disk objects included in the hard disk; Based on the hard disk frame corresponding to the candidate hard disk and the reference hard disk frame corresponding to the hard disk to which each target hard disk object belongs, determined in the previous loop, when it is determined that the candidate hard disk meets the second preset condition, a hard disk object is selected from the candidate hard disks as the target hard disk object; Based on the number of available hard disk objects included in the current candidate hard disk, the target position of the candidate hard disk in the max heap is determined, and after marking the candidate hard disk, the candidate hard disk is inserted into the target position; The first preset condition includes at least one of the following: the number of determined target hard disk objects reaches a first preset threshold; the number of iterations reaches a second preset threshold; the number of available hard disk objects corresponding to the candidate hard disk located at the top of the big heap is zero; the second preset condition is: the number of each reference hard disk frame is less than a preset number and each reference hard disk frame does not include the hard disk frame corresponding to the candidate hard disk, or the number of each reference hard disk frame is not less than a preset number.

2. The method according to claim 1, characterized in that, When the target storage area corresponds to the first type, each target hard disk object in the target storage area belongs to multiple hard disks in multiple storage pools, and the method further includes: If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, then delete the target hard drive object from the target storage area. If it is determined that the hard drive enclosure corresponding to any target hard drive object in the target storage area is faulty, then the target hard drive object is deleted from the target storage area. If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object belongs in the target storage area is faulty, then delete the target hard drive object from the target storage area. If it is determined that the target storage area contains only one target hard disk object, and the storage pool corresponding to the hard disk to which the target hard disk object belongs is faulty, the storage area corresponding to the hard disk of the target hard disk object is configured as a virtual storage pool.

3. The method according to claim 1, characterized in that, When the target storage area corresponds to the second type, each target hard disk object in the target storage area belongs to multiple hard disks in the same storage pool, and the method further includes: If it is determined that the hard drive to which any target hard drive object belongs in the target storage area is faulty, then delete the target hard drive object from the target storage area. If it is determined that the hard drive enclosure corresponding to any target hard drive object in the target storage area is faulty, then the target hard drive object is deleted from the target storage area. If it is determined that the storage pool corresponding to the hard drive to which any target hard drive object in the target storage area belongs is faulty, the target storage area is deleted.

4. The method according to any one of claims 1 to 3, characterized in that, Before acquiring at least one storage pool corresponding to the target storage region to be created, the method further includes: Create each of the aforementioned storage pools, and for each storage pool, add the hard disk corresponding to the storage pool and each hard disk object in the hard disk to the storage pool; Specifically, for any hard disk object, if it is determined based on the red-black tree algorithm that the hard disk objects included in the storage pool do not exist, then the hard disk object is added to the storage pool.

5. The method according to any one of claims 1 to 3, characterized in that, After constructing the target storage region, the method further includes: Based on the target structure, the target storage area is encapsulated to obtain a segment structure corresponding to the target storage area; The target structure is a structure used to encapsulate the storage area corresponding to memory, and the target structure includes: area type, number of replicas, and replica information; the area type corresponding to the target storage area is a hard disk, the number of replicas is the number of hard disk objects included, and the replica information is the object information of each hard disk object.

6. A storage area creation apparatus, characterized in that, The device includes: The acquisition module is used to acquire at least one storage pool corresponding to the target storage area to be created, wherein the storage pool includes multiple hard disks, and each hard disk includes multiple hard disk objects; The construction module is used to iteratively execute the following process for each storage pool until the determined target hard disk objects meet the first preset condition, and construct the target storage area based on the obtained target hard disk objects: From the max heap obtained in the previous loop, the candidate hard disk that is ranked first among the unmarked hard disks is taken out; wherein, the hard disks included in the storage pool are arranged in the max heap according to the number of available hard disk objects included in the hard disk; Based on the hard disk frame corresponding to the candidate hard disk and the reference hard disk frame corresponding to the hard disk to which each target hard disk object belongs, determined in the previous loop, when it is determined that the candidate hard disk meets the second preset condition, a hard disk object is selected from the candidate hard disks as the target hard disk object; Based on the number of available hard disk objects included in the current candidate hard disk, the target position of the candidate hard disk in the max heap is determined, and after marking the candidate hard disk, the candidate hard disk is inserted into the target position; The first preset condition includes at least one of the following: the number of determined target hard disk objects reaches a first preset threshold; the number of iterations reaches a second preset threshold; the number of available hard disk objects corresponding to the candidate hard disk located at the top of the big heap is zero; the second preset condition is: the number of each reference hard disk frame is less than a preset number and each reference hard disk frame does not include the hard disk frame corresponding to the candidate hard disk, or the number of each reference hard disk frame is not less than a preset number.

7. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method according to any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-5.

Citation Information

Patent Citations

  • Method and device for allocating distributed type storage magnetic discs

    CN104484134A

  • Storage user-defined data storage method, system and device

    CN108874913A