Metadata space management method, device and equipment and readable storage medium
By designating a default meta-data service to manage a storage pool and allocate space to others as needed, the method addresses inefficiencies in meta-data space management, ensuring robust operation across nodes with limited resources.
Patent Information
- Application Number
- CN202510544172.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-07-15
AI Technical Summary
In the scenario where the underlying layer can only provide one storage pool and limited memory and processor core, the existing technology cannot effectively implement metadata space management, resulting in the object storage daemon and reliable automatic distributed object storage to generate huge space and computing losses.
Select the target metadata service as the default metadata service to manage the logical space of the storage pool, and when the space of other metadata services is below the threshold, send space request instructions to it, allocate the logical space of the storage pool to be saved as its own metadata space, and manage the space by itself through the metadata service to reduce dependence on the object storage daemon and reliable automatic distributed object storage.
The spatial management of metadata services is simplified, and the metadata services of multiple nodes are perfectly operated in failure or ethereal scenarios, reducing the space and calculation losses of object storage daemons and reliable automatic distributed object storage.
Smart Images

Figure CN120315650A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, apparatus, device, and readable storage medium for metadata space management. Background Art
[0002] Distributed file system components usually implement metadata space management through reliable automatic distributed object storage and object storage daemons. An object storage daemon is started on each node to load the reliable automatic distributed object storage module. However, in a scenario where only one storage pool can be provided at the bottom layer and the memory and processor cores are limited, applying the object storage daemon and reliable automatic distributed object storage will result in a great deal of space and computing losses, and some logic is repeated. Therefore, in this scenario, it is impossible to effectively implement metadata space management by deploying the object storage daemon and reliable automatic distributed object storage. Summary of the Invention
[0003] The present invention provides a method, apparatus, device, and readable storage medium for metadata space management to at least solve the problem that metadata space management cannot be effectively implemented in a scenario where only one storage pool can be provided at the bottom layer and the memory and processor cores are limited in the related art.
[0004] The present invention provides a method for metadata space management, including:
[0005] Selecting a target metadata service as the default metadata service; the default metadata service is used to allocate and manage the logical space of the storage pool;
[0006] When the metadata space of other metadata services other than the target metadata service itself is lower than the lower limit threshold of use, sending an application space instruction to the target metadata service;
[0007] After the target metadata service responds to the application space instruction and allocates a part of the logical space of the storage pool to other metadata services, the other metadata services save the allocated space as their own metadata space.
[0008] The present invention also provides a metadata space management apparatus, including:
[0009] A default selection module, configured to select a target metadata service as the default metadata service; the default metadata service is used to allocate and manage the logical space of the storage pool;
[0010] An instruction sending module, configured to send an application space instruction to the target metadata service when the metadata space of other metadata services other than the target metadata service itself is lower than the lower limit threshold of use;
[0011] A space allocation module, after the target metadata service allocates a part of the logical space of the storage pool to other metadata services in response to the application space instruction, other metadata services save the allocated space as their own metadata space.
[0012] The present invention also provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of any of the above metadata space management methods when executing the computer program.
[0013] The present invention also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above metadata space management methods are implemented.
[0014] Through the present invention, the metadata space is managed by the metadata service itself, removing the redundant logic of the object storage daemon and the reliable automatic distributed object storage layer. First, a target metadata service is selected as the default metadata service; the default metadata service is used to allocate and manage the logical space of the storage pool; then, when the metadata space of other metadata services other than the target metadata service is lower than the lower limit threshold of use, an application space instruction is sent to the target metadata service; after the target metadata service allocates a part of the logical space of the storage pool to other metadata services in response to the application space instruction, other metadata services save the allocated space as their own metadata space, thus simplifying the space management of the metadata service. Only through one storage pool, the space management of the metadata services of multiple nodes is realized, ensuring that the metadata service can still operate perfectly in the case of failure or floating, no longer relying on the object storage daemon and the reliable automatic distributed object storage, and reducing the space and computing loss of the object storage daemon and the reliable automatic distributed object storage.
[0015] In addition, the present invention also provides a corresponding metadata space management device, electronic device and computer-readable storage medium for the metadata space management method, which have the same or corresponding technical features as the above-mentioned metadata space management method, and the effects are the same. Description of the Drawings
[0016] In order to more clearly illustrate the embodiments of the present invention, the drawings required for the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0017] Figure 1 It is a flowchart of the metadata space management method provided for the embodiments of the present invention;
[0018] Figure 2 Schematic diagram of the application process in the metadata space management method provided by an embodiment of the present invention;
[0019] Figure 3 Schematic diagram of the classification method of the log area and metadata space provided by an embodiment of the present invention;
[0020] Figure 4 Schematic diagram of the recall process in the metadata space management method provided by an embodiment of the present invention;
[0021] Figure 5 Schematic diagram of the structure of the metadata space management device provided by an embodiment of the present invention;
[0022] Figure 6 Schematic diagram of the structure of the electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0023] Under the deployment of the distributed file system component (such as CephFS, which is a distributed file system component in the Ceph distributed storage system) through the Object Storage Device (OSD) and the Reliable Autonomic Distributed Object Store (RADOS), the metadata space management is implemented and processed by the object storage daemon, and can manage the metadata in the corresponding Metadata Server (MDS). The metadata of the distributed file system component (such as directory structure, file index node inode, extended attributes, etc.) is converted into reliable autonomic distributed object storage objects by the metadata service and stored on the object storage daemon. Each metadata object corresponds to one or more file system metadata items (for example, the metadata of a directory). The object storage daemon supports the Object Map (OMAP) for efficiently storing the extended attributes and small-scale structured data (such as directory entries) of the metadata. The metadata service quickly reads and writes the metadata through the key-value storage interface. When a set of storage pools is provided at the bottom layer and the memory and core numbers of the file system are insufficient, applying the object storage daemon and the reliable autonomic distributed object storage will cause great space and computing losses, and some logic is repeated.
[0024] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.
[0025] It should be noted that in the description of the present invention, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present invention are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0026] To enable those skilled in the art of the present technology to better understand the solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] Combined with the specific application environment architecture or specific hardware architecture on which the execution of the metadata space management method depends, the specific application environment architecture or specific hardware architecture will be described herein.
[0028] An embodiment of the present invention provides a metadata space management method, which will be described in detail in combination with the execution process of the metadata space management method. Figure 1 It is a flowchart of the metadata space management method provided by the embodiment of the present invention. As Figure 1 shown, the method includes:
[0029] S101. Select a target metadata service as the default metadata service; the default metadata service is used to allocate and manage the logical space of the storage pool.
[0030] It should be noted that in a multi-control storage, the relationship between nodes and metadata services is one-to-one, that is, several nodes correspond to several metadata services. Since there is no management and protection of the object storage daemon and the reliable automatic distributed object storage layer, only multiple volume devices exist as the storage pool in the space of each metadata service, and the metadata space of the metadata service is written into this storage pool. That is, the metadata space provides a continuous logical space by the storage pool to achieve unified addressing.
[0031] When a node becomes disconnected, the metadata service drifts and can achieve smooth switching to provide services externally. That is, the metadata space of each metadata service must be exclusive and accessible on each node. Also, since the space of the storage pool is a continuous logical space, a server-like service is needed to uniformly manage this continuous address space and allocate it to all metadata services so that they can use it as their own metadata space. Moreover, since the metadata space management of the metadata service has functions similar to those of a local file system (bluefs), when bluefs starts, it needs to apply for or release space, so each metadata service must manage its own space independently, and a server is required to handle space allocation and recycling. Therefore, the present invention selects a target metadata service as the default metadata service, and this default metadata service can serve as the server for space management to allocate and manage the logical space of the storage pool. Other metadata services other than the target metadata service can act as clients for space management.
[0032] S102. When the metadata space of other metadata services other than the target metadata service is lower than the lower usage threshold, send a space application instruction to the target metadata service.
[0033] Figure 2 It is a schematic diagram of the application process in the metadata space management method provided by an embodiment of the present invention. In practice, as Figure 2 shown, when other metadata services (such as other metadata service 1 and other metadata service 2) use the metadata space, if their own space is insufficient, they apply for space from the target metadata service 0 acting as the server. Other metadata service 1 and other metadata service 2 respectively send space application instructions (including range request information) to the target metadata service. This is the starting action of the interaction. Then, after receiving the range request information, the target metadata service 0 performs the operation of obtaining data ranges and allocating them (Got extent and allocate), and the target metadata service 0 sends extent reply messages to other metadata service 1 and other metadata service 2 respectively to inform them of the allocation situation. After receiving the extent reply, other metadata service 1 and other metadata service 2 perform the operations of receiving the reply and data ranges (Got reply and extend), and send reply ack messages to the target metadata service 0. The target metadata service 0 performs the operation of receiving the confirmation (Gotack), receives the confirmation messages from other metadata service 1 and other metadata service 2, and sends sync ack messages to other metadata service 1 and other metadata service 2. Other metadata service 1 and other metadata service 2 receive this message to complete the entire interaction process.
[0034] S103. After the target metadata service responds to the application space instruction and allocates a part of the logical space of the storage pool to other metadata services, the other metadata services save the allocated space as their own metadata space.
[0035] In implementation, after other metadata services apply for space from the target metadata service and the target metadata service allocates it, the allocated space is saved as its own metadata space. In this way, the metadata service can manage its own space and obey the allocation of the metadata service. The execution subject of the above process can be a metadata server including the target metadata service and other metadata services.
[0036] In the above metadata space management method provided by the embodiments of the present invention, the metadata space is managed by the metadata service itself, removing the redundant logic of the object storage daemon process and the reliable automatic distributed object storage layer. First, a target metadata service is selected as the default metadata service; the default metadata service is used to allocate and manage the logical space of the storage pool; then, when the metadata space of other metadata services other than the target metadata service is lower than the lower limit threshold of use, an application space instruction is sent to the target metadata service; after the target metadata service responds to the application space instruction and allocates a part of the logical space of the storage pool to other metadata services, the other metadata services save the allocated space as their own metadata space. In this way, the space management of the metadata service is simplified, and the space management of the metadata services of multiple nodes is realized through only one storage pool, ensuring that the metadata service can still operate perfectly in the case of failure or floating scenarios, no longer relying on the object storage daemon process and the reliable automatic distributed object storage, and reducing the space and computing losses of the object storage daemon process and the reliable automatic distributed object storage.
[0037] Further, in specific implementation, in the above metadata space management method provided by the embodiments of the present invention, before selecting the target metadata service as the default metadata service, it may further include: reserving a space with a first set size in the storage pool as the startup space for each metadata service.
[0038] In implementation, each metadata service needs to use and release space when it starts. Because its implementation logic has built-in bluefs as the local file system, other metadata services as clients may not have space when they start, or because the target metadata service as the server is not started, other metadata services cannot apply for space from the target metadata service. At this time, they cannot wait for the target metadata service to start before starting. Therefore, it is necessary to reserve a part of the space in the storage pool in advance as the startup space of the metadata service. Each metadata service reserves a space of the first set size (such as 10G), which can ensure that all metadata services do not need to rely on the startup of the target metadata service during startup.
[0039] It should be added that the 10G space reserved for each metadata service is not enough for all metadata records. When 10G is exhausted, it is necessary to initiate an action to apply for space from the target metadata service. However, it is not possible to initiate a request every time metadata is recorded. In this case, a threshold control can be set. When the metadata space of other metadata services as clients is lower than the lower limit of usage, it is necessary to apply for space from the target metadata service. Assuming that the space applied for each time is 1G, the threshold can be set to 256M, that is, the space application is triggered when it is lower than 1 / 4 of the applied space.
[0040] Furthermore, in a specific implementation, in the above-mentioned metadata space management method provided in an embodiment of the present invention, while other metadata services save the allocated space as their own metadata space, it may also include: other metadata services record the allocated space into the log area by appending a log.
[0041] In implementation, the space applied for by other metadata services of the client cannot be stored only in the memory. If a power outage occurs, the applied space will be lost. Therefore, the present invention records the applied space, and in order to ensure atomic operation or prevent it from being written badly, the function of recording the space is realized by appending logs.
[0042] Furthermore, in a specific implementation, in the above-mentioned metadata space management method provided in an embodiment of the present invention, before selecting the target metadata service as the default metadata service, it also includes: reserving a space of a second set size in the storage pool as a log area for each metadata service; in each metadata service, the log area is adjacent to the startup space, and the log area is smaller than the startup space.
[0043] It should be noted that if logs are appended, the log space also needs to be continuously increased. Since the log area records the metadata space, and logs also need space, deadlocks are likely to occur. Therefore, a second set size (such as 4K) of space needs to be reserved for logs.
[0044] Figure 3 Schematic diagram of the classification method for the log area and metadata space provided by the embodiments of the present invention. As Figure 3 shown, each metadata service has a reserved space of 4K and a reserved space of 10G. The 4K space is adjacent to the reserved 10G space. The 4K space here is the log area of the metadata service, and the 10G space is the startup space of the metadata service.
[0045] Further, in specific implementation, in the above metadata space management method provided by the embodiments of the present invention, after reserving a space of a second set size in the storage pool as the log area for each metadata service, it may further include: dividing the log area into a first part space with a first set number of bytes and a second part space with a second set number of bytes in a linked list manner; using the first part space to record the logs of space application and release actions; generating a log record for each space application or use action, and the log records are sequentially stored in the first part space; after the first part space is full, applying for a new space of the second set size as the next log area; using the second part space to record the address information of the next log area, so as to use the next log area as the next node in the linked list; recording the logs of new space application and release actions in the next log area; when the corresponding first part space in the next log area is full, applying for a new space of the second set size again and recording the address information in the second part space of the next log area, so as to realize the linked list connection of all log areas.
[0046] In implementation, as Figure 3 shown, a 4K (usually referring to 4096 bytes) space certainly cannot store all space application and release actions, and the space cannot be reserved without limit as the log area, because this will cause waste of resources. To solve the above problems, the present invention can adopt a data structure based on a linked list to manage the log record space. The specific steps are as follows: divide a 4K (4096 bytes) log reserved area into two parts: the first part space is the first 4056 bytes, and this part of the space is used to record the logs of space application and release actions. Each space application or release operation will generate a log record, and these records will be sequentially stored in this 4056-byte space. The second part space is the last 50 bytes, and this part of the space is used to record the address information of the next 4K log space. In the linked list structure, this is equivalent to the "pointer" in the linked list node, which is used to point to the next node.
[0047] At the initial moment, the log of space application and release actions is recorded in the first 4056 bytes of the first 4K log reservation area. After the first 4056 bytes of the first 4K space are filled, the system will apply for a new 4K space. Then, the address information of this new 4K space is recorded in the last 50 bytes of the current 4K space. In this way, the new 4K space becomes the next node in the linked list. The subsequent log of space application and release actions will be recorded in the first 4056 bytes of the newly applied 4K space. When this new 4K space is also written to 4056 bytes, the system will apply for a new 4K space again and record its address in the last 50 bytes of the current 4K space, and so on, continuously expanding the linked list.
[0048] Through this linked list method, the system can dynamically expand the log recording space based on the limited 4K space, so as to record all space application and release actions, and at the same time avoid the waste of resources caused by unlimited space reservation. When viewing the log, it can start from the first 4K space and traverse the entire linked list in sequence according to the address information recorded in the last 50 bytes of each space to obtain all the log records.
[0049] In addition, when replaying the log space, the address of the second part of the space (i.e., the last 50 bytes) can be used as a basis to traverse all the log area spaces through this specific address information; from all the traversed log area spaces, filter out the log records related to the application and release actions. By analyzing the logs of these application and release actions, it is possible to know the situation of all the spaces that have been allocated in the metadata service. Based on the obtained allocation space information, the recording of the metadata space can be realized, that is, record the space allocation and other situations involved in the metadata service, ensure the complete recording of the space allocation information in the metadata service, and not miss important application and release operation logs, ensuring the accuracy and integrity of the data. When the metadata service starts, by replaying the log area space, that is, repeating the previous traversal and log acquisition operation process, all its own metadata space information can be obtained, so that the metadata service can know the current space state when starting, saving the startup time and resources, and improving the startup efficiency of the service.
[0050] Furthermore, in specific implementation, in the above metadata space management method provided by the embodiment of the present invention, it may further include: when at least one other metadata service sends a space application instruction to the target metadata service and the space to be allocated on the target metadata service is less than the applied space, the target metadata service sends a recall request to the other metadata services that have not sent the space application instruction to release the applied and idle space on the other metadata services accordingly.
[0051] In implementation, when one or more other metadata services apply for space from the target metadata service and the space on the target metadata service is insufficient, the target metadata service actively sends a recall request to all other metadata services acting as clients to actively reclaim the space that some metadata services have applied for but is idle, so as to achieve efficient reuse of space and avoid scenarios of actual space waste.
[0052] Further, in specific implementation, in the above-mentioned metadata space management method provided by the embodiments of the present invention, it may further include: when the metadata space of at least one other metadata service has been higher than the usage upper limit threshold within a set time period, the target metadata service sends a broadcast query request to the other metadata services; query the current remaining metadata space of the other metadata services; select the metadata service with the largest remaining metadata space among them, and initiate a recall request to the selected metadata service to release the corresponding remaining metadata space on the selected metadata service.
[0053] In implementation, when the space used by the metadata service has been higher than the usage upper limit threshold, for example, 3 / 4 of the remaining 1G, when the space of the target metadata service is insufficient, a recall action is initiated for the metadata service that has always been wealthy. Also, since the target metadata service does not know which metadata services are above the upper limit threshold, when the present invention initiates a recall request, it first sends a broadcast query request. The target metadata service sends a broadcast query request to all other metadata services, and after querying the current remaining metadata space of all other metadata services, it then selects the wealthiest metadata service among them and initiates a recall request.
[0054] Figure 4 It is a schematic diagram of the recall process in the metadata space management method provided by the embodiments of the present invention. As Figure 4As shown, the target metadata service 0 sends broadcast request messages to other metadata services 1 and 2 respectively; after receiving the broadcast requests, other metadata services 1 and 2 send reply messages to the target metadata service 0, feeding back relevant information on receiving the requests. The target metadata service 0 performs operations within the recall extent. The target metadata service 0 sends a recall extent message to other metadata service 2, and then performs the send reply operation. Other metadata service 2 performs the allocate and reply operation, processes and allocates the received information, and sends an extent reply message to the target metadata service 0. The target metadata service 0 performs the get ext and reply ack operation, and then sends a reply ack message to other metadata service 2. Other metadata service 2 performs the receive ack message operation, receives the ack message from the target metadata service 0, and sends a sync ack message to the target metadata service 0.
[0055] It should be noted that since applications and recalls are carried out through messages, and each metadata service may be interrupted during this period, a scenario of space loss is likely to occur. To avoid the occurrence of this scenario, through three interactions of messages, two submissions of space are made, thus solving the problem of space loss and achieving the complete consistency of the data space in the event of a failure scenario.
[0056] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0057] In the above embodiments, the metadata space management method has been described in detail. The present invention also provides corresponding embodiments of a metadata space management device and an electronic device. It should be noted that the present invention describes the embodiments of the device part from two perspectives, one is from the perspective of functional modules, and the other is from the perspective of hardware.
[0058] Figure 5 It is a schematic structural diagram of the metadata space management device provided by an embodiment of the present invention. In this embodiment, from the perspective of functional modules, as Figure 5 shown, the device includes:
[0059] A default selection module 10, configured to select a target metadata service as the default metadata service; the default metadata service is used to allocate and manage the logical space of the storage pool;
[0060] An instruction sending module 11, configured to send a space application instruction to a target metadata service when the metadata space of other metadata services except the target metadata service is lower than a lower limit threshold of usage;
[0061] A space allocation module 12, configured to, after the target metadata service responds to the space application instruction and allocates a part of the logical space of the storage pool to other metadata services, save the allocated space as its own metadata space by other metadata services.
[0062] In the above metadata space management device provided by the embodiments of the present invention, through the interaction of the above three modules, the metadata space can be managed by the metadata service itself, removing the redundant logic of the object storage daemon and the reliable automatic distributed object storage layer, thus simplifying the space management of the metadata service. Only through one storage pool, the space management of the metadata services of multiple nodes can be realized, ensuring that the metadata service can still operate perfectly in the case of failures or floating scenarios, no longer relying on the object storage daemon and the reliable automatic distributed object storage, and reducing the space and computing losses of the object storage daemon and the reliable automatic distributed object storage.
[0063] Since the embodiments of the metadata space management device part correspond to the embodiments of the metadata space management method part, the description of the features in the corresponding embodiments of the metadata space management device can refer to the relevant descriptions of the corresponding embodiments of the metadata space management method, which will not be elaborated here one by one. And it has the same beneficial effects as the above-mentioned metadata space management method.
[0064] Further, in specific implementation, in the above metadata space management device provided by the embodiments of the present invention, it may further include: a reserved space module, configured to reserve a space with a first set size in the storage pool as the startup space for each metadata service; reserve a space with a second set size in the storage pool as the log area for each metadata service; in each metadata service, the log area is adjacent to the startup space, and the log area is smaller than the startup space.
[0065] Further, in specific implementation, in the above metadata space management device provided by the embodiments of the present invention, the space allocation module 12 may specifically be configured to record the allocated space to the log area by other metadata services in a way of appending write logs, and at the same time save it as its own metadata space.
[0066] Further, in specific implementation, in the above metadata space management device provided by the embodiments of the present invention, it may further include: a log linked list generation module, configured to divide the log area into a first part of space with a first set number of bytes and a second part of space with a second set number of bytes in a linked list manner; use the first part of space to record the logs of space application and release actions; generate a log record for each space application or usage action, and the log records are sequentially stored in the first part of space; after the first part of space is full, apply for a new space of the second set size as the next log area; use the second part of space to record the address information of the next log area, so as to use the next log area as the next node in the linked list; record the logs of new space application and release actions in the next log area; when the corresponding first part of space in the next log area is full, apply for a new space of the second set size again and record the address information in the second part of space in the next log area, so as to realize the linked list connection of all log areas.
[0067] Further, in specific implementation, in the above metadata space management device provided by the embodiments of the present invention, it may further include: a space release module, configured to, when at least one other metadata service sends a space application instruction to the target metadata service and the space to be allocated on the target metadata service is less than the applied space, the target metadata service sends a recall request to other metadata services that have not sent the space application instruction, so as to release the applied and idle space on other metadata services accordingly; and is further configured to, when the metadata space of at least one other metadata service has been higher than the usage upper limit threshold within a set time period, the target metadata service sends a broadcast query request to other metadata services; query the current remaining metadata space of other metadata services; select the metadata service with the largest remaining metadata space among them, and send a recall request to the selected metadata service, so as to release the remaining metadata space on the selected metadata service accordingly.
[0068] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. This embodiment is from a hardware perspective, as Figure 6 shown, the electronic device includes: a memory 20, configured to store a computer program; a processor 21, configured to implement the steps of the metadata space management method as mentioned in the above embodiments when executing the computer program.
[0069] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may be integrated with a Graphics Processing Unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may further include an Artificial Intelligence (AI) processor, and the AI processor is used to process computational operations related to machine learning.
[0070] The memory 20 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 20 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201. After the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the metadata space management method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may further include an operating system 202 and data 203, etc., and the storage method may be transient storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the metadata space management method mentioned above.
[0071] In some embodiments, the electronic device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26. Those skilled in the art can understand that Figure 6 the structure shown in does not constitute a limitation on the electronic device, and it may include more or fewer components than shown in the figure. The electronic device provided by the embodiments of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the metadata space management method as mentioned above, and the effect is the same.
[0072] Finally, an embodiment of the present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described method embodiments for managing a metadata space when running.
[0073] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media capable of storing a computer program, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disc.
[0074] An embodiment of the present invention also provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described method embodiments for managing a metadata space.
[0075] An embodiment of the present invention also provides another computer program product, including a non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described method embodiments for managing a metadata space.
[0076] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled artisans can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present invention.
[0077] The above has introduced in detail a method, apparatus, device, and readable storage medium for managing a metadata space provided by the present invention. Specific examples are used herein to illustrate the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A method for managing a metadata space, characterized in that, Including: Selecting a target metadata service as the default metadata service; The default metadata service is used to allocate and manage the logical space of the storage pool; When the metadata space of other metadata services except the target metadata service itself is lower than the lower usage threshold, sending a space application instruction to the target metadata service; After the target metadata service responds to the space application instruction and allocates a part of the logical space of the storage pool to other metadata services, other metadata services save the allocated space as their own metadata space.
2. The metadata space management method according to claim 1, wherein Also including: When at least one other metadata service sends the space application instruction to the target metadata service and the space to be allocated on the target metadata service is less than the applied space, the target metadata service sends a recall request to other metadata services that have not sent the space application instruction to release the applied and idle space on other metadata services accordingly.
3. The metadata space management method according to claim 1, characterized in that Before selecting the target metadata service as the default metadata service, it also includes: Reserving a space with a first set size in the storage pool as the startup space for each metadata service.
4. The metadata space management method according to claim 3, wherein While other metadata services save the allocated space as their own metadata space, it also includes: Other metadata services record the allocated space in the log area by appending write logs.
5. The metadata space management method according to claim 4, wherein Before selecting the target metadata service as the default metadata service, it also includes: Reserving a space with a second set size in the storage pool as the log area for each metadata service; in each metadata service, the log area is adjacent to the startup space, and the log area is smaller than the startup space.
6. The metadata space management method according to claim 5, wherein After reserving a space with a second set size in the storage pool as the log area for each metadata service, it also includes: Dividing the log area into a first part of space with a first set number of bytes and a second part of space with a second set number of bytes in a linked list manner; Using the first part of space to record the logs of space application and release actions; each space application or usage action generates a log record, and the log records are sequentially stored in the first part of space; After the first part of space is full, applying for a new space with a second set size as the next log area; Using the second part of space to record the address information of the next log area to use the next log area as the next node in the linked list; Recording the logs of new space application and release actions in the next log area; When the first part of space corresponding to the next log area is full, applying for a new space with a second set size again and recording the address information in the second part of space in the next log area to realize the linked list connection of all log areas.
7. The metadata space management method according to claim 1, wherein Also including: When the metadata space of at least one other metadata service has been higher than the upper usage threshold within a set time period, the target metadata service sends a broadcast query request to other metadata services; Querying the current remaining metadata space of other metadata services; Select the metadata service with the largest remaining metadata space among them, and initiate a recall request to the selected metadata service to release the corresponding remaining metadata space on the selected metadata service.
8. A metadata space management device, characterized in that, Including: A default selection module for selecting a target metadata service as the default metadata service; The default metadata service is used to allocate and manage the logical space of the storage pool; An instruction sending module for sending a space application instruction to the target metadata service when the metadata space of other metadata services except the target metadata service itself is lower than the lower usage threshold; A space allocation module for, after the target metadata service responds to the space application instruction and allocates a part of the logical space of the storage pool to other metadata services, the other metadata services save the allocated space as their own metadata space.
9. An electronic device, characterized in that, Including: A memory for storing computer programs; A processor for implementing the steps of the metadata space management method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of the metadata space management method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Cited By
Storage pool space management method and electronic equipment
CN120994142A
