A method for space recycling in a distributed storage system controlled by a central node
By introducing a central node control method, the space reclamation priority of chunkgroups is calculated and reclamation tasks are centrally managed, which solves the problems of low disk space reclamation efficiency and poor stability in distributed storage systems, and achieves efficient and stable disk space management and data consistency.
Patent Information
- Application Number
- CN202411744399.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-11-30
AI Technical Summary
In distributed storage systems, existing technologies cannot effectively manage disk space reclamation, leading to disk space exhaustion, impacting read and write performance, and performing chunk file reclamation separately results in long reclamation times and frequent write and delete operation failures.
A central node control method is introduced, which calculates the space reclamation priority of chunkgroup, centrally manages and sorts reclamation tasks, ensures that all chunk files in the same chunkgroup are reclaimed at the same time, and limits the number of concurrent tasks to reduce the impact on normal read and write operations.
It improves disk space management efficiency, reduces storage fragmentation, maintains data consistency, simplifies operation processes, reduces the impact on normal read and write operations, and improves recycling efficiency and system stability.
Smart Images

Figure CN119828958B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method for space reclamation in a distributed storage system controlled by a central node. Background Technology
[0002] In distributed storage systems, data is typically stored redundantly. Redundancy methods include multiple replicas and erasure coding, where a single copy of data is stored across multiple different nodes in the distributed system to prevent data loss due to the failure of a single node. Data is stored as files, with multiple data records forming a block stored in a file called a chunk. Combining multiple chunk files distributed across different disk nodes forms a redundant failover group (hereinafter referred to as a chunkgroup). A chunkgroup is the most basic logical storage unit, similar to a Placement Group (PG) in a distributed file system (i.e., Ceph). When data is deleted using this redundancy method, multiple copies of the data in multiple chunk files must be deleted simultaneously.
[0003] Distributed storage system architecture such as Figure 1 As shown, in a distributed storage system, deleting data often involves marking the data as deleted, rather than directly removing it from the disk. After deletion, the data still occupies disk space, and without reclaiming this space, it may eventually run out. Therefore, disk space needs to be reclaimed. The typical method is to read the data that wasn't marked as deleted (i.e., valid data) from the chunk file and write it to a new chunk file, then delete the original chunk file, thus completing the space reclamation.
[0004] Performing space reclamation on a chunkgroup does not affect read operations within that chunkgroup; application nodes can directly read data from the chunkgroup. However, write and delete operations are affected. If new data needs to be written, it must be written to another chunkgroup. If data needs to be deleted from a chunkgroup, deletion will fail, and the application layer needs to save this failed request and retry it after space reclamation is complete. Therefore, chunks within the same chunkgroup should ideally be reclaimed simultaneously.
[0005] The read-write capability of the disk node is limited. When performing the space recycling task, the disk node needs to occupy part of the read-write capability, which may affect the normal read-write. If too many disk nodes in the cluster simultaneously perform the space recycling, the read-write of the whole cluster may be affected.
[0006] In the distributed storage system, the space recycling can be directly performed by each disk node respectively. The disk node regularly checks whether the chunk file on the disk meets the recycling condition. The recycling condition is mainly that the hole rate of the chunk file (i.e. the proportion of the deleted data part in the chunk file and the whole chunk file size) reaches the pre-set proportion, and then the space recycling can be started. This method is simple to implement. However, the problem is that the chunk files in each chunkgroup are recycled separately, not simultaneously, so the time of the whole chunkgroup being unavailable will be relatively long. If the write request and the delete request of the current chunkgroup appear, the write or delete will be easily failed. In addition, the write request needs the cooperation of multiple disks. If the load of a disk node is too high due to the space recycling, the write of the whole cluster will be affected. SUMMARY
[0007] The present application shows a space recycling method of a distributed storage system controlled by a center node.
[0008] In the first aspect, the present application shows a space recycling method of a distributed storage system controlled by a center node, which comprises:
[0009] setting a center control node;
[0010] the disk node reports the disk information and the chunk file information to the center control node;
[0011] the center control node calculates the space recycling priority of the chunkgroup and sorts according to the priority;
[0012] the center control node performs the space recycling task on the chunkgroup with high priority;
[0013] the center control node issues the space recycling task to the disk node, and the disk node performs the space recycling operation on all chunk files in the chunkgroup.
[0014] According to the method of the first aspect of the present application, the step of the disk node reporting the disk information and the chunk file information to the center control node comprises:
[0015] The disk node reports the chunk file hole rate and write rate to the center control node, the hole rate is the ratio of the identified deleted data and file size, and the write rate is the ratio of all written data and file size.
[0016] The center control node calculates the chunkgroup space recycling priority and sorts according to the priority, including: the center control point calculates the chunkgroup space recycling priority based on the uploaded hole rate and write rate, and recycles when the hole rate is greater than 50% and the write rate is greater than 80%.
[0017] According to the method of the first aspect of the application, the calculation method of the chunkgroup space recycling priority is:
[0018] Let the hole rate be E and the write rate be F, it is known that E
[0019] Hole rate: 0.5
[0020] Write rate: 0.8
[0021] Effective data: 0
[0022] The formula for calculating the priority P of a single chunk file in the chunkgroup is:
[0023] P = ((E-0.5)+(0.5-(F-E)))F
[0024] After simplification, we get:
[0025] P = (2E-F)F
[0026] The priority of the entire chunkgroup is the sum of the priorities of all chunk files.
[0027] The formula is as follows:
[0028] Total P = P1+P2+P3+....。
[0029] According to the method of the first aspect of the application, the idle time of the chunkgroup entering the priority ranking is more than 10 minutes before sorting, and the idle time is the current time-modification time.
[0030] According to the method of the first aspect of the application, the step of the center control node performing space recycling task on the chunkgroup includes:
[0031] S101, the center control node traverses a chunkgroup queue to be recycled;
[0032] S102, a chunkgroup is obtained from the queue;
[0033] S103, it is judged whether the hole rate of the chunkgroup meets the condition, if yes, the center control node continues to traverse the chunk file list in the chunkgroup, if not, another chunkgroup is selected;
[0034] S104, a chunk file information is obtained from the traversed chunk file list, and then disk node information corresponding to the chunk file is obtained;
[0035] S105, it is judged whether the load of the disk node meets the condition, if yes, the information of the next chunk file is obtained, if not, the recycling task is put back into the queue;
[0036] S106, when the hole rate of the chunkgroup meets the requirement and the loads of the disk nodes corresponding to all the chunk files in the chunkgroup meet the condition, the traversal ends, and a space recycling task is started.
[0037] According to the method of the first aspect of the application, when the space recycling task is executed, the center control point performs a freezing operation on the corresponding chunkgroup, and new write requests will not be written into the chunkgroup.
[0038] According to the method of the first aspect of the application, the load condition of the disk node is that only one task can be executed concurrently in the same disk node at the same time.
[0039] According to the method of the first aspect of the application, when the disk node performs the space recycling operation on the chunk file, the disk node is prohibited from receiving a data deletion request, if there is a new deletion request, the disk node returns a deletion failure signal, and notifies the center control node after the recycling task is completed.
[0040] According to the method of the first aspect of the application, after the center control node receives the recycling task completion notification of the disk node, the chunkgroup is unfrozen, and the unfrozen chunkgroup can continue to receive write requests.
[0041] According to the method of the first aspect of the application, the disk information includes disk read-write load and disk capacity.
[0042] The technical solution provided by the application can have the following beneficial effects:
[0043] The application can simultaneously recycle all chunk files of the same chunkgroup, has less impact on write deletion, and has higher recycling efficiency and better recycling effect. The space recycling tasks of the cluster are centrally managed in the central control node, the space recycling tasks are uniformly distributed on each disk node, the load balancing of each disk node is ensured, and the impact on normal read-write-deletion operations is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0044] Figure 1 is a structural schematic diagram of the distributed storage system architecture in the background section of the application.
[0045] Figure 2 is a step flowchart of a space recycling method of a distributed storage system controlled by a central node according to the application. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the application.
[0047] Referring to Figure 2 , a step flowchart of a space recycling method of a distributed storage system controlled by a central node according to the application is shown, wherein the method can specifically include the following steps:
[0048] In step S101, the central control node receives chunk file information in a chunkgroup reported by a disk node, the central control node sorts space recycling tasks, and then traverses a chunkgroup queue with high priority;
[0049] In step S102, a chunkgroup is obtained from the queue;
[0050] In step S103, it is judged whether the hole rate of the chunkgroup meets the condition, i.e., the hole rate of all chunk files is greater than 50%. If it meets, the central control node continues to traverse the chunk file list in the chunkgroup. If it does not meet, a chunkgroup is reselected;
[0051] In step S104, a chunk file information is obtained from the traversed chunk file list, and then the disk node information corresponding to the chunk file is obtained;
[0052] In step S105, it is judged whether the load of the disk node meets the condition. If yes, the information of the next chunk file is obtained, and if not, the recycling task is put back into the queue, and step S102 is repeated.
[0053] In step S106, when the hole rate of the chunkgroup meets the requirement and the load of the disk node corresponding to all chunk files in the chunkgroup meets the condition, the traversal ends, and the space recycling task is started.
[0054] The present application shows a space recycling method of a distributed storage system controlled by a center node, which comprises:
[0055] A center control node is set, which is responsible for managing the space recycling tasks of all disk nodes, and according to the condition of each chunkgroup, a recycling priority scoring algorithm is used to sort the chunkgroups according to the scores of each chunkgroup. The chunkgroup with a high score is recycled first. In addition, the center control node also controls the number of recycling tasks on each disk node according to the read-write load of the disk node, so as to minimize the influence of space recycling task on normal read-write.
[0056] All disk nodes report the corresponding disk information and chunk file information to the center control node;
[0057] The center control node calculates the space recycling priority of each chunkgroup and sorts them according to the priority;
[0058] The center control node executes the space recycling task on the chunkgroup with high priority, i.e. with a high score;
[0059] The center control node assigns the space recycling task to the disk node, and the disk node executes the space recycling operation on all chunk files in the chunkgroup.
[0060] The main purpose of the disk node executing the space recycling operation on all chunk files in the chunkgroup is:
[0061] First, it can improve the management efficiency of disk space. Recovering the space of all chunk files can ensure the maximum utilization of storage resources. When part of the chunk files are recycled, there may be many scattered and underutilized space blocks left, which may be difficult to effectively utilize in subsequent file allocation, resulting in space waste. Performing a recycling operation on all chunk files can simplify the space management logic of the disk node. There is no need to track and decide the usage of each chunk file separately, thereby reducing the complexity and cost of management.
[0062] Second, it can maintain the performance of the storage system. Recovering the space of all chunk files helps to reduce the generation of storage fragmentation. When part of the chunk files are recycled, there may be many small and discontinuous space blocks left, which may cause an increase in storage fragmentation in subsequent file allocation, thereby affecting the read-write performance of the disk. After recovering the space of all chunk files, the disk node can more easily perform file allocation. In subsequent file allocation, it can be easier to find continuous and large blocks of space to meet the file storage requirements, thereby improving the efficiency and quality of file allocation.
[0063] Third, it can ensure data consistency. Recovering the space of all chunk files can ensure the accuracy of metadata. When deleting or modifying chunk files, if the underlying storage system does not update its state in time, it may cause inconsistency of metadata. By recovering the space of all chunk files, the state of the storage system can be kept consistent with the state of the file system, thereby maintaining the integrity of the data. Regularly performing a space recycling operation on all chunk files in a chunk group can prevent potential problems such as data loss or damage. This helps to maintain the stability and reliability of the storage system, ensuring long-term preservation and availability of data.
[0064] Fourth, it can simplify the operation and management process. Performing a recycling operation on all chunk files can reduce the complexity of the operation. There is no need to make separate judgments and handle the usage of each chunk file, thereby simplifying the operation process and management workload. By recovering the space of all chunk files, the management efficiency of the storage system can be improved. Administrators can more easily monitor and manage the usage of storage resources, and timely adjust and optimize to meet the changes and development of business requirements.
[0065] According to the method of the present application, the step of the disk node reporting disk information and chunk file information to the central control node comprises:
[0066] The disk node reports the hole rate and the write rate of the chunk file to the center control node, the hole rate is the proportion of the deleted data and file size, and the write rate is the proportion of all written data and file size.
[0067] The center control node calculates the chunkgroup space recycling priority and sorts according to the priority, including: the center control point calculates the chunkgroup space recycling priority based on the uploaded hole rate and write rate, and recycles when the hole rate is greater than 50% and the write rate is greater than 80%.
[0068] The hole rate refers to the ratio of unused space to total space in the chunk file. When the hole rate is greater than 50%, it means that more than half of the space in the chunk file is not effectively utilized. In this case, recycling can bring the following benefits:
[0069] First, improve space utilization. Through recycling, these unused spaces can be released and reallocated to other chunk files that need to store data, thereby improving the space utilization of the entire storage system.
[0070] Second, reduce storage fragmentation. As data is deleted and modified, many small and discontinuous space blocks (i.e. fragmentation) may be generated in the chunk file. These fragments may cause storage efficiency to decrease in subsequent file allocation. Through recycling, these fragments can be integrated into continuous space blocks, thereby reducing the generation of storage fragments.
[0071] The write rate refers to the ratio of data written to the file size in the current chunk file. When the write rate is greater than 80%, it means that the chunk file is undergoing more data writing. In this case, recycling can bring the following benefits:
[0072] First, efficient use of storage space. When the write rate is high, it means that the chunk file is receiving a large amount of data writing. If there are a large number of holes (i.e. unused space) in the chunk file at this time, the write operation may frequently cross these holes, resulting in a decrease in write performance. Through recycling, these hole spaces can be released, making the write operation more continuous and efficient, thereby improving the overall performance of the storage system. As data is continuously written, if the hole rate of the chunk file remains high and the write rate also remains high, the storage limit of the chunk file may be reached soon, resulting in data overflow (i.e. data overflow). Through timely recycling, this situation can be prevented, ensuring normal storage and writing of data.
[0073] Second, it can balance the cost and benefit of recovery. Recovery operation consumes certain system resources, including CPU, memory, and I / O, etc. If the recovery is frequently performed on chunk files with low write rate, it may bring unnecessary system overhead and affect the overall performance of the storage system. When the write rate is high, the benefit brought by the recovery operation is more obvious. By releasing the empty space, the space utilization and write performance of the storage system can be significantly improved, thus providing users with better user experience.
[0074] Third, ensure data consistency. During the recovery process, it is necessary to ensure that the metadata of the storage system and the state of the file system remain consistent. When the write rate is high, it means that the chunk file is being frequently written and modified. At this time, the recovery operation can more easily ensure the accuracy of the metadata and avoid data inconsistency problems. Regularly performing recovery operations on chunk files with high write rates can prevent potential problems such as data loss or damage. This helps to maintain the stability and reliability of the storage system and ensures the long-term preservation and availability of data.
[0075] According to the method of the present application, each disk node periodically reports the disk read-write load and disk capacity to the central control node; periodically checks the chunk file hole rate (identifies the proportion of deleted data and file size), write rate (all write data and file size proportion), if the chunk file is modified and meets the reporting conditions (hole rate greater than 50% and write rate greater than 80%), the disk node reports the hole rate, write rate and modification time to the central control node.
[0076] The main purpose of each disk node periodically reporting the disk read-write load and disk capacity to the central control node is:
[0077] First, the central control node needs to know the status of each disk node in real time or periodically to ensure the healthy operation of the entire storage system.
[0078] By collecting disk read-write load and capacity information, the control node can monitor the overall performance of the system and timely discover potential performance bottlenecks or abnormalities.
[0079] Second, in a distributed storage system, load balancing is crucial to ensure that all nodes share the load evenly and avoid single-point overload.
[0080] Through the reported read-write load information, the central control node can dynamically adjust data distribution and migrate high-load tasks to low-load nodes to achieve load balancing.
[0081] Third, disk capacity is one of the important resources of the storage system, and understanding its usage is crucial for reasonable planning and management of storage resources.
[0082] Through the reported disk capacity information, the central control node can predict future storage needs and add new storage devices or perform expansion operations in a timely manner to avoid service interruptions caused by insufficient storage space.
[0083] Fourth, disk failure is one of the common risks in storage systems. Timely detection and handling of failed nodes can minimize the risk of data loss and service interruption.
[0084] Through the periodic reporting of disk status information, the central control node can detect abnormal disk nodes (such as read-write speed reduction, capacity anomalies, etc.) and take appropriate preventive measures such as data migration, fault alarm, etc.
[0085] Fifth, the central control node can analyze the usage patterns and trends of the storage system based on the reported load and capacity information, thereby optimizing the storage strategy.
[0086] For example, adjusting data read-write strategies based on load conditions, optimizing data storage layout based on capacity usage, etc.
[0087] According to the method of the present application, the central control node performs space recycling task scheduling. The central control node calculates the space recycling priority of the chunkgroup by calculating the hole rate and write rate of all chunk files corresponding to each chunkgroup, and sorts according to the priority.
[0088] In the space recycling process, the higher the hole rate, the more disk space that can be recycled, and the better the recycling effect. In the space recycling process, effective data needs to be written to new chunk files. The more effective data (write rate - hole rate), the greater the impact on system performance, and the smaller the effective data, the smaller the impact on system performance.
[0089] Generally, writing and deleting chunkgroup data is continuous. The write control algorithm will try to fill a chunkgroup as much as possible. The higher the write rate, the longer the idle time (current time - modification time), the less likely it is to modify chunk files during the recycling process, and the smaller the impact of recycling.
[0090] The calculation method of the chunkgroup space recycling priority is:
[0091] Let the hole rate be E and the write rate be F. Given that E < F, assume that recycling is performed only when the hole rate is greater than 50% and the write rate is greater than 80%, then:
[0092] Hole rate: 0.5 < E < 1
[0093] Write rate: 0.8 < F < 1
[0094] Valid data: 0 < F-E < 0.5
[0095] The priority of space recycling is positively related to the hole rate and the write rate, and is inversely related to the valid data. The formula for calculating the priority P of a single chunk file in a chunk group is:
[0096] P = ((E-0.5)+(0.5-(F-E)))F
[0097] After simplification, we get:
[0098] P = (2E-F)F
[0099] The priority of each chunk file in a chunk group is calculated separately, and the priority of the entire chunk group is the sum of the priorities of all chunk files.
[0100] The formula is as follows:
[0101] Total P = P1+P2+P3+.....
[0102] According to the method of the present application, the chunk group entering the priority queue is sorted only when the idle time exceeds 10 minutes, and the idle time is the current time minus the modification time.
[0103] For the idle time, only the chunk group whose idle time meets certain conditions (default setting of 10 minutes) is sorted. The purpose of this is:
[0104] First, if the chunk group is sorted frequently, it will consume a large amount of computing resources and time, thereby affecting the overall performance of the system.
[0105] By setting an idle time threshold (such as 10 minutes), we can ensure data order while reducing unnecessary sorting operations, thereby improving the efficiency of the system.
[0106] Second, system resources (such as CPU, memory, etc.) are limited, and frequent sorting will consume a large amount of resources, preventing other tasks from being processed in a timely manner.
[0107] By setting an idle time threshold, we can reasonably utilize system resources and ensure that more important tasks are processed first in the case of limited resources.
[0108] Third, sorting operations themselves consume certain system resources, including computing resources, memory resources, and I / O resources, etc.
[0109] By limiting the frequency of sorting (i.e., setting an idle time threshold), system overhead can be reduced, and the service life of the system can be extended.
[0110] Fourth, frequent sorting of data can damage the stability of the data, leading to data inconsistency or loss.
[0111] By setting a reasonable idle time threshold, the stability of the data can be maintained while ensuring data order, reducing data problems caused by sorting operations.
[0112] Fifth, data order is crucial to the performance and stability of the system, but frequent sorting operations can result in significant system overhead.
[0113] By setting an idle time threshold, the system overhead can be balanced while ensuring data order, achieving the best balance between performance and stability.
[0114] According to the method of the present application, the central control node performs a space recycling task. As shown in Figure 2 The central control node traverses the space recycling task list, selects a chunkgroup, and determines whether the chunkgroup's hole rate meets the recycling requirements. It then traverses all disk nodes corresponding to the chunk files to determine whether the read-write load of the disk nodes meets the execution conditions. Only when all disk nodes meet the execution conditions will the space recycling task be started.
[0115] When starting the space recycling task, the central control node performs a freeze operation on the corresponding chunkgroup. New write requests will not be able to access the chunkgroup in the task, and no new data will be written to the chunkgroup in the task. The main purpose is:
[0116] First, if new data is allowed to be written to the recycled chunkgroup during the space recycling task, it may cause data inconsistency problems.
[0117] The freeze operation can ensure that the data in the recycled chunkgroup does not change during the recycling process, thereby maintaining data consistency.
[0118] Second, the space recycling task may involve data migration, deletion, and other operations, which need to be performed in a safe environment.
[0119] The freeze operation can prevent new write requests from interfering with the execution of the recycling task, thereby improving the security of the task.
[0120] Third, allowing new data to be written to the recycled chunkgroup can increase the complexity and uncertainty of the system, which can affect the stability of the system.
[0121] By freezing the operation, the processing logic of the recycling task can be simplified, potential errors and failures can be reduced, and the stability of the system can be improved.
[0122] Fourth, during the execution of the recycling task, if new data is written to the recycled chunkgroup, it may cause data conflict and overwrite problems.
[0123] The freezing operation can ensure that no new data is written to the recycled chunkgroup before the recycling task is completed, thereby preventing data conflicts from occurring.
[0124] Fifth, the freezing operation can reduce the amount of data processed by the recycling task, as no new data is written to the recycled chunkgroup.
[0125] This helps to speed up the execution of the recycling task and improve recycling efficiency.
[0126] The central control node also needs to control the number of concurrent tasks of the disk node, and the same disk can only execute one task at the same time. If a task is already being executed, the next task can only be executed after the previous task is completed. The main reason for this is:
[0127] First, the disk is a shared resource, and multiple tasks accessing the disk at the same time may cause resource competition and conflict, reducing the access efficiency of the disk.
[0128] By limiting the number of concurrent tasks, we can avoid multiple tasks competing for disk resources, reduce conflicts and waiting time, and improve the access performance of the disk.
[0129] Second, multiple tasks writing to the disk at the same time may cause data inconsistency and damage, especially when the disk I / O operation is busy.
[0130] By ensuring that only one task accesses the disk at the same time, we can reduce the risk of data conflict and damage, and maintain the consistency and integrity of the data.
[0131] Third, allowing multiple tasks to execute simultaneously can increase the uncertainty of the system, making the execution time of the task unpredictable.
[0132] By limiting the number of concurrent tasks, we can make the task execution more orderly and predictable, which is convenient for system management and monitoring.
[0133] Fourth, multiple tasks executing simultaneously consume more system resources, including CPU, memory, and I / O, etc.
[0134] By limiting the number of concurrent tasks, the consumption of system resources can be reduced, the system overhead can be reduced, and the overall performance of the system can be improved.
[0135] Fifth, the disk has its own processing capacity and limitations, and multiple tasks executing simultaneously may overload the disk, leading to performance degradation or even crash.
[0136] By limiting the number of concurrent tasks, disk overload can be prevented, and the healthy operation of the disk can be protected.
[0137] According to the method of the present application, the disk node processes the space recycling task. The disk node receives the recycling task issued by the central control node and starts to perform the recycling operation on the chunk file.
[0138] During the recycling process, the disk node prohibits receiving delete data requests, and if there are delete requests, it returns a delete failure.
[0139] The reason for the disk node returning a delete failure is:
[0140] First, the recycling process may involve data migration, merging or deletion operations, which need to ensure the consistency and integrity of the data.
[0141] If delete requests are allowed during the recycling process, data may be accidentally deleted or overwritten, thereby damaging the consistency of the data.
[0142] Therefore, prohibiting the reception of delete requests can ensure that the data during the recycling process will not be accidentally modified or deleted.
[0143] Second, the recycling task is a complex process that needs to ensure that it will not be disturbed by other operations during execution.
[0144] Allowing delete requests may interfere with the execution of the recycling task, causing task failure or data corruption.
[0145] By prohibiting the reception of delete requests, the recycling task can be ensured to be executed in a safe and stable environment.
[0146] Third, delete requests may cause data to be permanently deleted, while the recycling process may be trying to recover or protect these data.
[0147] If delete requests are allowed during the recycling process, the data being recycled may be accidentally deleted, resulting in data loss.
[0148] Therefore, prohibiting the reception of delete requests can prevent data from being accidentally deleted during the recycling process.
[0149] Fourth, allowing deletion requests can increase the complexity and uncertainty of the system, thereby affecting the stability of the system.
[0150] By prohibiting the reception of deletion requests, the processing logic of the recycling task can be simplified, potential errors and failures can be reduced, and the stability of the system can be improved.
[0151] The center control node is notified after the recycling task is executed. The center task node receives the recycling task completion notification of all chunk files of the chunkgroup. The chunkgroup is thawed, and the chunkgroup that has completed the thawing operation can continue to receive write requests.
[0152] The present application has the following advantages:
[0153] 1. The chunk files of the same chunkgroup are recycled at the same time, and the impact on write deletion is small.
[0154] 2. The center control node sorts all recycling tasks, which improves the recycling efficiency and effect.
[0155] 3. The center control node adjusts the execution of space recycling tasks according to the load of the cluster to avoid affecting normal read and write.
[0156] It should be noted that for the method embodiments, in order to simply describe, they are all described as a series of action combinations, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, some steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.
[0157] Optionally, the present application also provides an electronic device, which comprises a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the processes of the above method embodiments and achieves the same technical effects. To avoid repetition, this will not be repeated here.
[0158] The embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to realize each process of the method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein. The computer readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0159] It should be noted that in this document, the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusions, so that processes, methods, articles or devices that include a series of elements not only include those elements, but also include other elements not explicitly listed, or include elements inherent to such processes, methods, articles or devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0160] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present application.
[0161] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, which are only illustrative and not restrictive. Those skilled in the art can make many forms under the inspiration of the present application without departing from the scope of the present application and the protection scope of the claims.
[0162] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solutions. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0163] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
[0164] In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented by other manners. For example, the apparatus embodiments described above are only schematic, for example, the division of the units is only a logical function division, and another division manner can be used in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0165] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0166] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0167] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, and various program code storage media.
[0168] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for space reclamation in a distributed storage system controlled by a central node, characterized in that, The method comprises: Setting a central control node; The disk node reports disk information and chunk file information to the central control node; The central control node calculates the chunkgroup space recycling priority and sorts according to the priority; The central control node performs a space recycling task on the chunkgroup with high priority; The central control node assigns the space recycling task to the disk node, and the disk node performs a space recycling operation on all chunk files in the chunkgroup; The calculation method of the chunkgroup space recycling priority is: Let the hole rate be E and the write rate be F, given E < F, suppose that the hole rate is greater than 50% and the write rate is greater than 80% to perform recycling, then: Hole rate: 0.5 < E < 1 Write rate: 0.8 < F < 1 Effective data: 0 < F-E < 0.5 The formula for calculating the priority P of a single chunk file in the chunkgroup is: P = ((E-0.5)+(0.5-(F-E)))F After simplification, we get: P = (2E-F)F The priority of the entire chunkgroup is the sum of the priorities of all chunk files.
2. The method of claim 1, wherein, The step of the disk node reporting disk information and chunk file information to the central control node comprises: The disk node reports the hole rate and write rate of the chunk file to the central control node, the hole rate is the proportion of the size of the deleted data and file, and the write rate is the proportion of the size of all written data and file; The step of the central control node calculating the chunkgroup space recycling priority and sorting according to the priority comprises: the central control node calculates the chunkgroup space recycling priority based on the uploaded hole rate and write rate, and performs recycling when the hole rate is greater than 50% and the write rate is greater than 80%.
3. The method of claim 1, wherein, The idle time of the chunkgroup entering the priority sorting is more than 10 minutes, and the idle time is the current time - modification time.
4. The method of claim 1, wherein, The step of the central control node performing a space recycling task on the chunkgroup comprises: S101, the central control node traverses the chunkgroup queue to be recycled; S102, a chunkgroup is obtained from the queue; S103, it is judged whether the hole rate of the chunkgroup meets the condition, if yes, the central control node continues to traverse the chunk file list in the chunkgroup, if not, a chunkgroup is selected again; S104, a chunk file information is obtained from the traversed chunk file list, and the disk node information corresponding to the chunk file is obtained; S105, it is judged whether the load of the disk node meets the condition, if yes, the information of the next chunk file is obtained, if not, the recycling task is put back into the queue; S106, when the hole rate of the chunkgroup meets the requirement and the load of the disk node corresponding to all chunk files in the chunkgroup meets the condition, the iteration ends and a space recycling task is started.
5. The method of claim 1, wherein, When the space recycling task is executed, the central control point performs a freezing operation on the corresponding chunkgroup, and new write requests will not be written into the chunkgroup.
6. The method of claim 4, wherein, The load condition of the disk node is that only one task can be executed concurrently at the same time in the same disk node.
7. The method of claim 1, wherein, When the disk node performs a space recycling operation on the chunk file, the disk node is prohibited from receiving a delete data request. If there is a new delete request, the disk node returns a delete failure signal, and notifies the central control node after the recycling task is completed.
8. The method of claim 7, wherein, After the central control node receives the recycling task completion notification from the disk node, the chunkgroup is unfrozen. The unfrozen chunkgroup can continue to receive write requests.
9. The method of claim 1, wherein, The disk information includes disk read-write load and disk capacity.
Citation Information
Patent Citations
Data recovery method and system
CN110716690A
Prioritization and Source-Nonspecific Based Virtual Machine Recovery Apparatuses, Methods and Systems
US20200159625A1