Data pool management method, computer equipment, storage medium and program product

By directly managing the data pool in the metadata server of Ceph distributed storage system and processing file truncation requests, the problem of slow file truncation request processing is solved, and more efficient storage management and more reliable data processing is achieved.

CN119396597AActive Publication Date: 2025-02-07INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411989952.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-02-07
Estimated Expiration
2044-12-31

AI Technical Summary

Technical Problem

In Ceph distributed storage systems, file truncate requests are processed at a low speed, especially when processing very large files, a large number of 4M blocks need to be released, resulting in inefficient processing.

Method used

By managing data pools in the metadata server (MDS), directly processing file truncation requests, avoiding complex block release operations through the OSD layer. The specific steps include receiving a file truncation request, sending a space application request to the metadata server, allocating the target space and defining it as a file header, adjusting the file header content and freeing up the storage space.

Benefits of technology

It simplifies the file truncation processing process, improves the processing efficiency of truncate requests, reduces resource usage, ensures data consistency, and improves the reliability of distributed storage systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396597A_ABST
    Figure CN119396597A_ABST
Patent Text Reader

Abstract

The invention relates to a data pool management method, computer equipment, a storage medium and a program product, and belongs to the technical field of distributed storage, the method comprises the following steps: when a first file truncation request corresponding to a target file is received, sending a first space application request to a first metadata server; receiving a first target space distributed according to the first space application request, and defining the first target space as a first file header; adding the first file header into the first file truncation request to generate a second file truncation request, and sending the second file truncation request to a second metadata server; receiving an adjustment result obtained by adjusting a second file header of the target file and contents in the second file header according to the second file truncation request; and releasing the corresponding storage space according to the adjustment result. According to the method and the device, resource occupation is reduced, and the processing efficiency of the trunk request and the reliability of the distributed storage system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed storage technology, and in particular to a data pool management method, computer equipment, storage medium and program product. Background Art

[0002] In Ceph (open source distributed storage system), OSD (Object Storage Daemon) is the key component responsible for managing actual data storage. Each OSD node is responsible for managing a part of the storage space and works together through the RADOS (Reliable Autonomic Distributed Object Store) layer to ensure data distribution, replication, and recovery. Among them, for the management of data storage space, OSD must rely on the RADOS layer. When executing the file truncate process, OSD is used to process the block content that needs to be released by the background file itself. Client (Ceph client) and MDS (Metadata Server) only need to update the file metadata content (file size and time).

[0003] OSD manages the data pool space for the entire Ceph cluster operation, which means it can implement large and comprehensive functions such as object storage, block storage, and file storage. However, in scenarios where users only use file storage, object storage is not needed. At this time, if OSD management is still used, it must not only be paired with RADOS components, but OSD also needs to manage the corresponding metadata pool, resulting in the need for multiple layers to handle the entire environment. In addition, file storage still needs to provide MDS services, which will make the current storage process too complicated. When truncating a file, OSD actually splits it into 4M blocks and releases it. When a file is very large, all 4M blocks need to be found and released, resulting in a lower processing speed for truncate requests. Summary of the invention

[0004] Based on this, it is necessary to provide a data pool management method, computer equipment, storage medium and program product that can improve the efficiency of truncate request processing in response to the above technical problems.

[0005] In a first aspect, a data pool management method is provided, the method comprising: Upon receiving a first file truncation request corresponding to the target file, sending a first space application request to the first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; adding the first file header to the first file truncation request, generating a second file truncation request, and sending the second file truncation request to the second metadata server; receiving an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; According to the adjustment result, the corresponding storage space is released.

[0006] Optionally, before receiving the first file truncation request corresponding to the target file, the method further includes: Receive a target file creation request; When receiving the target file creation request, sending a second space application request to the first metadata server; receiving a second target space allocated by the first metadata server according to the second space application request, and defining the second target space as a second file header; The basic information of the target file is saved in the second file header, and the second file header storing the basic information of the target file is bound to the target file, and is saved to the distributed storage system client and the second metadata server respectively.

[0007] Optionally, before receiving the first file truncation request corresponding to the target file, the method further includes: Based on the server, a first file truncation request corresponding to the target file is sent to the distributed storage system client.

[0008] Optionally, after the first metadata server allocates the first target space to the distributed storage system client according to the first space application request, the method further includes: In response to the first target space being allocated, returning a first space application request to the distributed storage system client based on the first metadata server; When receiving the first space application request returned by the first metadata server, the distributed storage system client defines the first target space as the first file header.

[0009] Optionally, after defining the first target space as the first file header, the method further includes: Clear the content in the second file header stored in the distributed storage system client.

[0010] Optionally, before adjusting the second file header of the target file and the content in the second file header according to the second file truncation request, the method further includes: Obtaining the truncated file size and the first file header in the second file truncation request; Based on the truncated file size, a target adjustment mechanism is determined to adjust the second file header of the target file and the content in the second file header based on the target adjustment mechanism and the first file header.

[0011] Optionally, based on the cutoff file size, the target adjustment mechanism is determined to include: In response to the truncated file size being the target value, determining the target adjustment mechanism to be a first target adjustment mechanism; In response to the truncated file size not being the target value, determining the target adjustment mechanism to be a second target adjustment mechanism.

[0012] Optionally, adjusting the second file header of the target file and the content in the second file header based on the first target adjustment mechanism and the first file header includes: The second file header of the target file is replaced with the first file header as the current file header of the target file, and the data block corresponding to the second file header is added to the release queue. At the same time, a second file truncation request is returned to the distributed storage system client.

[0013] Optionally, before adjusting the second file header of the target file and the content in the second file header based on the second target adjustment mechanism and the first file header, the method further includes: Based on the background thread, read the data block corresponding to the second file header, and write the data block corresponding to the second file header into the object storage to the metadata pool; In response to the completion of writing the object, a record log is generated, and the record log includes the object name.

[0014] Optionally, adjusting the second file header of the target file and the content in the second file header based on the second target adjustment mechanism and the first file header includes: Based on the background thread, read the data block corresponding to the second file header; According to the size of the truncated file, the data blocks corresponding to the second file header are divided into data blocks that need to be written back and data blocks that need to be released; The data blocks that need to be written back are written back to the second file header, the data blocks that need to be released are added to the release queue, and at the same time, the second file truncation request is returned to the distributed storage system client.

[0015] Optionally, in response to a failure of the second metadata server during the process of writing back the data block, the method further includes: Performing failure recovery on the second metadata server; In response to the second metadata server failure being recovered, reading the target record log; According to the object name in the target record log, the data block corresponding to the object name is read, and the data block corresponding to the object name is rewritten back to the second file header.

[0016] Optionally, also include: Detect whether there is a need to save the data block that needs to be written back based on the first file header; In response to there being no need to save the data block that needs to be written back based on the first file header, the first file header is added to the release queue.

[0017] Optionally, also include: In response to the distributed storage system client receiving the second file truncation request returned by the second metadata server, determining that the second file truncation request has been processed; In response to the second file truncation request having been processed, sending the adjustment result of the second file header to the plurality of distributed storage system clients based on the second metadata server; When receiving the adjustment result of the second file header, the multiple distributed storage system clients synchronously adjust the second file header and the content in the second file header stored in the corresponding distributed storage system clients.

[0018] Optionally, according to the adjustment result, releasing corresponding storage space includes: Get the release queue; Determine and release the storage space occupied by the data block and / or the first file header in the queue, and release the storage space.

[0019] In a second aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: Upon receiving a first file truncation request corresponding to the target file, sending a first space application request to the first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; adding the first file header to the first file truncation request, generating a second file truncation request, and sending the second file truncation request to the second metadata server; receiving an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; According to the adjustment result, the corresponding storage space is released.

[0020] In a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: Upon receiving a first file truncation request corresponding to the target file, sending a first space application request to the first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; adding the first file header to the first file truncation request, generating a second file truncation request, and sending the second file truncation request to the second metadata server; receiving an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; According to the adjustment result, the corresponding storage space is released.

[0021] In a fourth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented: Upon receiving a first file truncation request corresponding to the target file, sending a first space application request to the first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; adding the first file header to the first file truncation request, generating a second file truncation request, and sending the second file truncation request to the second metadata server; receiving an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; According to the adjustment result, the corresponding storage space is released.

[0022] The above-mentioned data pool management method, computer device, storage medium and program product, the method comprises: upon receiving a first file truncation request corresponding to a target file, sending a first space application request to a first metadata server, wherein the file truncation request includes the truncated file size, and the space application request includes the applied space size; receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; adding the first file header to the first file truncation request, generating a second file truncation request, and sending the second file truncation request to a second metadata server; receiving a request from the second metadata server for the target file according to the second file truncation request The second file header and the adjustment result obtained by adjusting the content in the second file header, wherein the file header is bound to the file and is used to store basic information of the file; according to the adjustment result, the corresponding storage space is released. In the scenario where only file storage is applied, the present application implements the file truncate action by using MDS (metadata server) to manage the data pool, which not only reduces the code architecture and resource usage, but also simplifies the overall process, making the truncate process execution speed faster and improving the processing efficiency of the truncate request. In addition, processing the entire truncate request by MDS can ensure data consistency and improve the reliability of the distributed storage system. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is a flow chart of a data pool management method in one embodiment; Figure 2 A schematic diagram of a file adjustment process of a data pool management method in one embodiment; Figure 3 It is another schematic diagram of a file adjustment process of a data pool management method in one embodiment; Figure 4 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as including but not limited to.

[0026] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.

[0027] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.

[0028] In one embodiment, Figure 1 As shown, a data pool management method is provided, comprising the following steps: S1: upon receiving a first file truncation request corresponding to a target file, sending a first space application request to a first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size.

[0029] It should be noted that the first file truncation request corresponding to the target file is received through the distributed storage system client. The distributed storage system client refers to Ceph Client. Ceph is an open source distributed storage system that aims to provide high-performance, reliable and scalable storage solutions. Ceph It can provide object storage, block storage and file system storage services at the same time, which makes it a very flexible choice and suitable for a variety of application scenarios, including cloud computing, data centers and large-scale data storage. Metadata server refers to MDS. MDS nodes are responsible for managing the metadata of Ceph file system, that is, the directory tree structure and attribute information of the file system. MDS nodes provide metadata services by cooperating with each other to support efficient access to large-scale file systems. The first metadata server generally refers to the master node MDS0, which can be used to allocate space. File truncation request refers to truncate request. "Truncate" is an operation, usually used in file systems. When a file is truncated, its content will be reduced to the specified size. If the specified size is less than the current size of the file, the excess data will be deleted. If the specified size is greater than the current size of the file, the file size will increase, but the newly added part will be filled with zero or remain undefined. The truncated file size is the above-mentioned file specified size, which is determined according to demand. Space application request refers to a request for space allocation. The size of the space applied can be determined according to actual demand, and its preferred value is 4k.

[0030] In some specific implementations, before receiving the first file truncation request corresponding to the target file, the method further includes: Based on the distributed storage system client, a target file creation request is received to create a target file for storing file data and file metadata, and the target file creation request is issued by the server; When creating a target file, the distributed storage system client sends a second space application request to the first metadata server, wherein the second space application request also includes the size of the applied space, which can be determined according to actual needs, and its preferred value is 4k; The first metadata server allocates the second target space to the distributed storage system client according to the second space application request. After receiving the second target space, the distributed storage system client defines the second target space as the second file header, where the file header refers to the header, which is a data structure. The header is mainly used to save the basic information content of the file, such as the file modification time, file size and space map (data structure). Because each file cannot determine its final size, a map mapping is used to save the corresponding space block obtained by the application. When writing data later, for example, when the file appends 1M data, the file only has a 4k header at this time, so it is necessary to apply to MDS0 for more than 1M space to store the data to be written by the Client. At this time, this part of the newly allocated space is written to the corresponding space map. When reading and writing files later, the corresponding space block can be found from the space map for reading and writing, thereby realizing the file reading and writing of the Client. The basic information data of the file is stored in the second file header here; The basic information of the target file is saved in the second file header, the second file header storing the basic information of the target file is bound to the target file, and saved to the distributed storage system client and the second metadata server respectively, wherein the second metadata server is the MDS node corresponding to the distributed storage system client, which can be MDS0 or other nodes.

[0031] Specifically, when creating a file, the Client actively sends a request to MDS0 for a 4K space. MDS0 allocates the corresponding space and returns the request. When the Client obtains the 4K space, it uses it as the header of the new file and binds the header of the new file to the new file, and saves it to the Ceph Client and the MDS node corresponding to the Ceph Client.

[0032] In some specific implementations, before receiving the first file truncation request corresponding to the target file, the method further includes: Based on the server, a first file truncation request corresponding to the target file is sent to the distributed storage system client, wherein, Figure 2 and Figure 3 As shown, the truncate request is sent by the server to the distributed storage system client and is processed by the distributed storage system client and the MDS node.

[0033] In the above implementation, the corresponding file header is constructed when the file is created, so that when a file truncation request is received, the space occupied by the target file is directly adjusted through the generated spare file header, thereby improving the execution speed of the truncate request.

[0034] S2: Receive a first target space allocated by the first metadata server according to the first space application request, and define the first target space as a first file header.

[0035] It should be noted that the first metadata server allocates the first target space to the distributed storage system client according to the first space application request, and sends it to the distributed storage system client. The first file header is a backup header. The first target space is generally 4k space, which is a data structure. The basic information data of the file is not stored in the first target space.

[0036] In some specific implementations, after the first metadata server allocates the first target space to the distributed storage system client according to the first space application request, the method further includes: In response to the first target space being allocated, returning a first space application request to the distributed storage system client based on the first metadata server; When receiving the first space application request returned by the first metadata server, the distributed storage system client defines the first target space as the first file header.

[0037] In some specific implementations, after defining the first target space as a first file header, the method further includes: Clear the content in the second file header stored in the distributed storage system client.

[0038] Specifically, when the Client responds to a truncate request, that is, when it truncates the target file, it actively sends a request to MDS0 for a 4K space. MDS0 allocates the corresponding space and returns the request. After obtaining the 4K space, the Client uses it as a backup header for the target file and clears the header content of the target file itself on the Client side. Because the target file header has been cleared, the corresponding data block management is also gone, and the target file cannot be read or written on the current Client at this time.

[0039] In the above implementation, a spare file header corresponding to the space occupied by the target file is generated by the applied space, and the content stored in the second file header of the distributed storage system client is cleared to avoid data inconsistency problems caused by file modifications on the Client side during the file truncation request processing.

[0040] S3: Add the first file header to the first file truncation request to generate a second file truncation request, and send the second file truncation request to the second metadata server.

[0041] It should be noted that the second file truncation request includes the first file header, ie, the backup header. The second metadata server is the MDS node corresponding to the distributed storage system client, which may be MDS0 or other nodes, and is used to manage metadata information.

[0042] Specifically, after clearing the original header content of the target file, a truncate request is sent to the MDS, and the truncate request carries the backup header data just applied for.

[0043] In the above implementation, by adding the backup header to the file truncation request and sending it to the MDS, it is ensured that the MDS can manage the data pool and then implement the file truncate action, thereby reducing the code architecture, simplifying the overall process, and reducing resource usage.

[0044] S4: Receive an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file.

[0045] It should be noted that the adjustment result is received by the distributed storage system client, and the truncated file size generally includes two situations: the specified size is 0 and the size is not 0, and there are corresponding adjustment mechanisms to adjust the second file header of the target file and the content in the second file header.

[0046] In some specific implementations, before adjusting the second file header of the target file and the content in the second file header according to the truncated file size and the first file header, the method further includes: Obtaining the truncated file size and the first file header in the second file truncation request; Based on the truncated file size, a target adjustment mechanism is determined to adjust the second file header of the target file and the content in the second file header based on the target adjustment mechanism and the first file header.

[0047] In some specific implementations, determining a target adjustment mechanism based on the truncated file size includes: In response to the truncated file size being the target value, determining the target adjustment mechanism to be the first target adjustment mechanism, wherein the target value is the aforementioned 0, that is, when the truncated file specified size is 0, the second file header of the target file and the content in the second file header are adjusted through the first target adjustment mechanism and the first file header; In response to the truncated file size not being the target value, the target adjustment mechanism is determined to be the second target adjustment mechanism, that is, when the truncated file specified size is not 0, the second file header of the target file and the content in the second file header are adjusted through the second target adjustment mechanism and the first file header.

[0048] In some specific embodiments, Figure 2 As shown, based on the first target adjustment mechanism and the first file header, adjusting the second file header of the target file and the content in the second file header includes: The second file header of the target file is replaced with the first file header as the current file header of the target file, and the data block corresponding to the second file header is added to the release queue. At the same time, a second file truncation request is returned to the distributed storage system client.

[0049] Specifically, when MDS receives a truncate request, it determines that the specified size of the truncated file is 0, that is, all the file data block contents can be released. Then, the current header of the target file is stored in the release queue of the file, and the backup header in the truncate request is updated to the header of the file. At this time, the content in the header is empty and there is no data in it. At this time, the truncate request can be returned to determine that the truncate request has been processed. The release queue can be slowly released by the MDS's own background thread later, without blocking the current truncate request and being able to respond quickly.

[0050] In the above implementation, when the specified size of the truncated file is 0, the file truncate request is responded to by directly replacing the header, thereby improving the processing speed of the truncate request.

[0051] In some specific implementations, before adjusting the second file header of the target file and the content in the second file header based on the second target adjustment mechanism and the first file header, the method further includes: Based on the background thread, read the data block corresponding to the second file header, and write the data block corresponding to the second file header into the object storage to the metadata pool, wherein the data block in the file header is a data block generated based on the map mapping, and is used to map with the data content of the target file; In response to the completion of writing the object, a record log is generated, and the record log includes the object name.

[0052] In some specific embodiments, Figure 3 As shown, based on the second target adjustment mechanism and the first file header, adjusting the second file header of the target file and the content in the second file header includes: Based on the background thread, read the data block corresponding to the second file header; According to the size of the truncated file, the data blocks corresponding to the second file header are divided into data blocks that need to be written back and data blocks that need to be released; The data blocks that need to be written back are written back to the second file header, the data blocks that need to be released are added to the release queue, and at the same time, the second file truncation request is returned to the distributed storage system client.

[0053] In some specific implementations, in response to the second metadata server failing during the process of writing back the data block, the method further includes: Performing failure recovery on the second metadata server; In response to the second metadata server failure being recovered, reading the target record log; According to the object name in the target record log, the data block corresponding to the object name is read, and the data block corresponding to the object name is rewritten back to the second file header.

[0054] In some embodiments, the method further comprises: Detect whether there is a need to save the data block that needs to be written back based on the first file header; In response to there being no need to save the data block that needs to be written back based on the first file header, the first file header is added to the release queue.

[0055] Specifically, the MDS receives a truncate request and determines that the truncate size is not 0, that is, only the data block space corresponding to the specified size needs to be released. At this time, the data block content in the original header of the target file needs to be read out and divided into two parts. One part is the data block within the specified size, which still needs to be used, and the other part is the data block content outside the specified size, which needs to be added to the release queue for release. Based on this, the data block to be retained and continued to be used is written back to the header, and the data block to be released is added to the release queue. However, if the MDS fails during the write-back process, the data block written into the header of the target file is incomplete, resulting in a scenario of data inconsistency. Based on this, before writing back the retained data block to the header, all the original data blocks of the target file are read out first, and written into the object storage to the metadata pool. The object is used to record all the data blocks before the file is truncate. There is a data block. After writing the object, the journal is recorded. The journal carries the name of the object. If the MDS fails during the process of writing the data block back to the header, the header of the target file is in an abnormal state, that is, the content in the header is inaccurate. After the MDS fails, when replaying the log, the journal recorded above is read out, and the object content, that is, all the data blocks in the original header of the target file, is read according to the object name recorded in the log. All the read data blocks are rewritten to the header. At this time, the file truncate request is not processed, and the target file is still in the initial state. The original data blocks are still intact, thereby avoiding the scenario of data inconsistency. On this basis, the file truncate request continues to be responded to. This is the corresponding processing method when the MDS fails. If the MDS does not fail, the write-back process continues after recording the log.

[0056] Furthermore, when the write-back process is completed, it may be necessary to use 4K space as a map to record continuous data blocks. That is, when the original header of the target file cannot store all the data blocks that need to be written back, the backup header carried in the truncate request will be used as the newly inserted map. If the map of 4K space is not needed, the backup header in the truncate request will also be added to the release queue to complete the space release.

[0057] Furthermore, in the process of reading data blocks from the original header and writing data blocks back to the header, the disk reading and writing process needs to occur. This operation is a blocking operation. If it is executed directly in the MDS message thread, all message processing will be blocked. Based on this, when a request to truncate to a specified size is identified, a background thread is started to read or write back the data block corresponding to the header, and the message thread exits directly. At this time, it is necessary to ensure that the lock of the target file is occupied. When the background thread completes the corresponding operation, the request is retried. The MDS reprocesses the request for truncate of the specified size and determines whether the read and write header actions are executed based on the flag bit specified by the background thread. When the write back is completed, the truncate request is marked as processed, and the log is recorded and replied to the Client, that is, the second file truncation request is returned to the distributed storage system client.

[0058] In some embodiments, the method further comprises: In response to the distributed storage system client receiving the second file truncation request returned by the second metadata server, determining that the second file truncation request has been processed; In response to the second file truncation request being processed, sending the adjustment result of the second file header to the multiple distributed storage system clients based on the second metadata server, wherein the adjustment result includes the adjustment results corresponding to the first target adjustment mechanism and the second target adjustment mechanism; When receiving the adjustment result of the second file header, the multiple distributed storage system clients synchronously adjust the second file header and the content in the second file header stored in the corresponding distributed storage system clients.

[0059] Specifically, when the truncate request is returned, MDS will pass the updated header of the target file to each client through the message MClientCap (management client permissions and capabilities) in the truncate action. After receiving the message, the client will re-update the file size, time and header according to the content transmitted in the message. At this time, the header corresponding to each client is the updated header. For example, when the first target adjustment mechanism is used to adjust the file header, the spare header generated based on the requested 4k space when the truncate request is sent has been converted to the actual header of the target file corresponding to each client, and the original header of the target file has been replaced by M DS is added to the release queue, and the background gradually releases the contents in the header. At this point, the request to truncate to 0 is completed, and the header is replaced. There is no data block in the new header. The original header is added to the release queue, and the MDS background releases the data block space. Similarly, when the second target adjustment mechanism is used to adjust the file header, in the subsequent process, MDS will pass the updated header of the target file to each Client through the message MClientCap in the truncate action. After receiving the message, the Client re-updates the file size, time and header according to the content passed in the message. At this point, the request to truncate to the specified size is completed.

[0060] In the above implementation, the file truncate action is completed by writing back the header. For a truncation file request of a specified size, the integrity of the file data block is ensured when a failure occurs by recording a new journal, thereby improving the processing speed of the truncate request and ensuring the data consistency of the file.

[0061] S5: Release corresponding storage space according to the adjustment result.

[0062] It should be noted that the storage space is the storage space corresponding to the header and / or data block in the release queue.

[0063] In some specific implementations, releasing the corresponding storage space according to the adjustment result includes: Get the release queue; Determine and release the storage space occupied by the data block and / or the first file header in the queue, and release the storage space, wherein the storage space is released through the MDS background.

[0064] In the above implementation, the corresponding occupied space is released through the MDS background, thereby avoiding blocking the current truncate request and improving the response speed of the truncate request.

[0065] In some embodiments, the method further comprises: Obtain the size of the storage space to be released corresponding to the target release queue at multiple time nodes within multiple time periods, where the time period can be set according to actual needs, such as one week; In response to the size of the storage space to be released being greater than a first preset threshold, marking a time node corresponding to the size of the storage space to be released, wherein the first preset threshold can be set according to actual needs; Obtain the number of times the target time node is marked in multiple time periods, and determine the ratio of the number of times marked to the number of time periods; In response to the ratio being greater than the second preset threshold, determining the number of threads of the target release queue, including: calculating a quotient between the size of the storage space to be released corresponding to the target release queue and a third preset threshold, and if the mantissa of the quotient is greater than 0.5, rounding up the quotient; if the mantissa of the quotient is less than or equal to 0.5, rounding down the quotient to generate the number of threads, wherein the second preset threshold and the third preset threshold can be set according to actual needs; In response to the time node in the current time period being marked, multiple threads are started based on the corresponding number of threads, and the storage space to be released is released at the same time. If the mantissa of the quotient is less than or equal to 0.5, the tasks corresponding to the excess storage space to be released are assigned to any thread for processing.

[0066] In the above implementation, when the storage space to be released is large, tasks corresponding to the storage space to be released are processed simultaneously through multiple threads, thereby improving the release efficiency of the storage space and further reducing resource occupation.

[0067] In the above-mentioned data pool management method, the method includes: when receiving a first file truncation request corresponding to a target file, sending a first space application request to a first metadata server, wherein the file truncation request includes the truncated file size, and the space application request includes the applied space size; receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; adding the first file header to the first file truncation request, generating a second file truncation request, and sending the second file truncation request to a second metadata server; receiving an adjustment result obtained by the second metadata server adjusting the second file header of the target file and the content in the second file header according to the second file truncation request, wherein the file header is bound to the file , used to store basic information of files; according to the adjustment results, the corresponding storage space is released. In the scenario where only file storage is applied, this application removes the OSD and RADOS layers in the Ceph architecture to avoid implementing file truncate actions through OSD, and implements file truncate actions by using MDS (metadata server) to manage the data pool. This not only reduces the code architecture and resource usage, but also simplifies the overall process. The MDS message thread occupancy time is shorter, making the truncate process execution speed faster and improving the processing efficiency of truncate requests. In addition, by processing the entire truncate request through MDS, data consistency can be guaranteed and the reliability of the distributed storage system can be improved.

[0068] It should be understood that although Figure 1-Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0069] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data pool management method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0070] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0071] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented: S1: upon receiving a first file truncation request corresponding to a target file, sending a first space application request to a first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; S2: receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; S3: adding the first file header to the first file truncation request to generate a second file truncation request, and sending the second file truncation request to the second metadata server; S4: receiving an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; S5: Release corresponding storage space according to the adjustment result.

[0072] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Receive a target file creation request; When receiving the target file creation request, sending a second space application request to the first metadata server; receiving a second target space allocated by the first metadata server according to the second space application request, and defining the second target space as a second file header; The basic information of the target file is saved in the second file header, and the second file header storing the basic information of the target file is bound to the target file, and is saved to the distributed storage system client and the second metadata server respectively.

[0073] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Based on the server, a first file truncation request corresponding to the target file is sent to the distributed storage system client.

[0074] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: In response to the first target space being allocated, returning a first space application request to the distributed storage system client based on the first metadata server; When receiving the first space application request returned by the first metadata server, the distributed storage system client defines the first target space as the first file header.

[0075] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Clear the content in the second file header stored in the distributed storage system client.

[0076] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Obtaining the truncated file size and the first file header in the second file truncation request; Based on the truncated file size, a target adjustment mechanism is determined to adjust the second file header of the target file and the content in the second file header based on the target adjustment mechanism and the first file header.

[0077] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: In response to the truncated file size being the target value, determining the target adjustment mechanism to be a first target adjustment mechanism; In response to the truncated file size not being the target value, determining the target adjustment mechanism to be a second target adjustment mechanism.

[0078] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: The second file header of the target file is replaced with the first file header as the current file header of the target file, and the data block corresponding to the second file header is added to the release queue. At the same time, a second file truncation request is returned to the distributed storage system client.

[0079] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Based on the background thread, read the data block corresponding to the second file header, and write the data block corresponding to the second file header into the object storage to the metadata pool; In response to the completion of writing the object, a record log is generated, and the record log includes the object name.

[0080] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Based on the background thread, read the data block corresponding to the second file header; According to the size of the truncated file, the data blocks corresponding to the second file header are divided into data blocks that need to be written back and data blocks that need to be released; The data blocks that need to be written back are written back to the second file header, the data blocks that need to be released are added to the release queue, and at the same time, the second file truncation request is returned to the distributed storage system client.

[0081] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Performing failure recovery on the second metadata server; In response to the second metadata server failure being recovered, reading the target record log; According to the object name in the target record log, the data block corresponding to the object name is read, and the data block corresponding to the object name is rewritten back to the second file header.

[0082] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Detect whether there is a need to save the data block that needs to be written back based on the first file header; In response to there being no need to save the data block that needs to be written back based on the first file header, the first file header is added to the release queue.

[0083] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: In response to the distributed storage system client receiving the second file truncation request returned by the second metadata server, determining that the second file truncation request has been processed; In response to the second file truncation request having been processed, sending the adjustment result of the second file header to the plurality of distributed storage system clients based on the second metadata server; When receiving the adjustment result of the second file header, the multiple distributed storage system clients synchronously adjust the second file header and the content in the second file header stored in the corresponding distributed storage system clients.

[0084] In one embodiment, when the processor executes the computer program, the processor further implements the following steps: Get the release queue; Determine and release the storage space occupied by the data block and / or the first file header in the queue, and release the storage space.

[0085] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: S1: upon receiving a first file truncation request corresponding to a target file, sending a first space application request to a first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; S2: receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; S3: adding the first file header to the first file truncation request to generate a second file truncation request, and sending the second file truncation request to the second metadata server; S4: receiving an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; S5: Release corresponding storage space according to the adjustment result.

[0086] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Receive a target file creation request; When receiving the target file creation request, sending a second space application request to the first metadata server; receiving a second target space allocated by the first metadata server according to the second space application request, and defining the second target space as a second file header; The basic information of the target file is saved in the second file header, and the second file header storing the basic information of the target file is bound to the target file, and is saved to the distributed storage system client and the second metadata server respectively.

[0087] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Based on the server, a first file truncation request corresponding to the target file is sent to the distributed storage system client.

[0088] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: In response to the first target space being allocated, returning a first space application request to the distributed storage system client based on the first metadata server; When receiving the first space application request returned by the first metadata server, the distributed storage system client defines the first target space as the first file header.

[0089] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Clear the content in the second file header stored in the distributed storage system client.

[0090] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Obtaining the truncated file size and the first file header in the second file truncation request; Based on the truncated file size, a target adjustment mechanism is determined to adjust the second file header of the target file and the content in the second file header based on the target adjustment mechanism and the first file header.

[0091] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: In response to the truncated file size being the target value, determining the target adjustment mechanism to be a first target adjustment mechanism; In response to the truncated file size not being the target value, determining the target adjustment mechanism to be a second target adjustment mechanism.

[0092] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: The second file header of the target file is replaced with the first file header as the current file header of the target file, and the data block corresponding to the second file header is added to the release queue. At the same time, a second file truncation request is returned to the distributed storage system client.

[0093] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Based on the background thread, read the data block corresponding to the second file header, and write the data block corresponding to the second file header into the object storage to the metadata pool; In response to the completion of writing the object, a record log is generated, and the record log includes the object name.

[0094] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Based on the background thread, read the data block corresponding to the second file header; According to the size of the truncated file, the data blocks corresponding to the second file header are divided into data blocks that need to be written back and data blocks that need to be released; The data blocks that need to be written back are written back to the second file header, the data blocks that need to be released are added to the release queue, and at the same time, the second file truncation request is returned to the distributed storage system client.

[0095] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Performing failure recovery on the second metadata server; In response to the second metadata server failure being recovered, reading the target record log; According to the object name in the target record log, the data block corresponding to the object name is read, and the data block corresponding to the object name is rewritten back to the second file header.

[0096] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Detect whether there is a need to save the data block that needs to be written back based on the first file header; In response to there being no need to save the data block that needs to be written back based on the first file header, the first file header is added to the release queue.

[0097] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: In response to the distributed storage system client receiving the second file truncation request returned by the second metadata server, determining that the second file truncation request has been processed; In response to the second file truncation request having been processed, sending the adjustment result of the second file header to the plurality of distributed storage system clients based on the second metadata server; When receiving the adjustment result of the second file header, the multiple distributed storage system clients synchronously adjust the second file header and the content in the second file header stored in the corresponding distributed storage system clients.

[0098] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Get the release queue; Determine and release the storage space occupied by the data block and / or the first file header in the queue, and release the storage space.

[0099] In one embodiment, a computer program product is provided, the computer program product comprising a computer program, the computer program when executed by a processor implements the following steps: S1: upon receiving a first file truncation request corresponding to a target file, sending a first space application request to a first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; S2: receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; S3: adding the first file header to the first file truncation request to generate a second file truncation request, and sending the second file truncation request to the second metadata server; S4: receiving an adjustment result obtained by the second metadata server adjusting the second file header and the content in the second file header of the target file according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; S5: Release corresponding storage space according to the adjustment result.

[0100] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Receive a target file creation request; When receiving the target file creation request, sending a second space application request to the first metadata server; receiving a second target space allocated by the first metadata server according to the second space application request, and defining the second target space as a second file header; The basic information of the target file is saved in the second file header, and the second file header storing the basic information of the target file is bound to the target file, and is saved to the distributed storage system client and the second metadata server respectively.

[0101] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Based on the server, a first file truncation request corresponding to the target file is sent to the distributed storage system client.

[0102] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: In response to the first target space being allocated, returning a first space application request to the distributed storage system client based on the first metadata server; When receiving the first space application request returned by the first metadata server, the distributed storage system client defines the first target space as the first file header.

[0103] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Clear the content in the second file header stored in the distributed storage system client.

[0104] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Obtaining the truncated file size and the first file header in the second file truncation request; Based on the truncated file size, a target adjustment mechanism is determined to adjust the second file header of the target file and the content in the second file header based on the target adjustment mechanism and the first file header.

[0105] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: In response to the truncated file size being the target value, determining the target adjustment mechanism to be a first target adjustment mechanism; In response to the truncated file size not being the target value, determining the target adjustment mechanism to be a second target adjustment mechanism.

[0106] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: The second file header of the target file is replaced with the first file header as the current file header of the target file, and the data block corresponding to the second file header is added to the release queue. At the same time, a second file truncation request is returned to the distributed storage system client.

[0107] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Based on the background thread, read the data block corresponding to the second file header, and write the data block corresponding to the second file header into the object storage to the metadata pool; In response to the completion of writing the object, a record log is generated, and the record log includes the object name.

[0108] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Based on the background thread, read the data block corresponding to the second file header; According to the size of the truncated file, the data blocks corresponding to the second file header are divided into data blocks that need to be written back and data blocks that need to be released; The data blocks that need to be written back are written back to the second file header, the data blocks that need to be released are added to the release queue, and at the same time, the second file truncation request is returned to the distributed storage system client.

[0109] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Performing failure recovery on the second metadata server; In response to the second metadata server failure being recovered, reading the target record log; According to the object name in the target record log, the data block corresponding to the object name is read, and the data block corresponding to the object name is rewritten back to the second file header.

[0110] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Detect whether there is a need to save the data block that needs to be written back based on the first file header; In response to there being no need to save the data block that needs to be written back based on the first file header, the first file header is added to the release queue.

[0111] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: In response to the distributed storage system client receiving the second file truncation request returned by the second metadata server, determining that the second file truncation request has been processed; In response to the second file truncation request having been processed, sending the adjustment result of the second file header to the plurality of distributed storage system clients based on the second metadata server; When receiving the adjustment result of the second file header, the multiple distributed storage system clients synchronously adjust the second file header and the content in the second file header stored in the corresponding distributed storage system clients.

[0112] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: Get the release queue; Determine and release the storage space occupied by the data block and / or the first file header in the queue, and release the storage space.

[0113] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0114] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0115] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.

Claims

1. A data pool management method, characterized in that: The method comprises: Upon receiving a first file truncation request corresponding to the target file, sending a first space application request to the first metadata server, wherein the file truncation request includes a truncated file size, and the space application request includes an applied space size; receiving a first target space allocated by the first metadata server according to the first space application request, and defining the first target space as a first file header; adding the first file header to the first file truncation request to generate a second file truncation request, and sending the second file truncation request to a second metadata server; receiving an adjustment result obtained by the second metadata server adjusting the second file header of the target file and the content in the second file header according to the second file truncation request, wherein the file header is bound to the file and is used to store basic information of the file; According to the adjustment result, the corresponding storage space is released.

2. The data pool management method according to claim 1, characterized in that: Before receiving a first file truncation request corresponding to the target file, the method further includes: Receive a target file creation request; When receiving the target file creation request, sending a second space application request to the first metadata server; receiving a second target space allocated by the first metadata server according to the second space application request, and defining the second target space as a second file header; The basic information of the target file is saved in the second file header, the second file header storing the basic information of the target file is bound to the target file, and the two files are saved to the distributed storage system client and the second metadata server respectively.

3. The data pool management method according to claim 1, characterized in that: Before receiving a first file truncation request corresponding to the target file, the method further includes: Based on the server, a first file truncation request corresponding to the target file is sent to the distributed storage system client.

4. The data pool management method according to claim 1, characterized in that: After the first metadata server allocates the first target space according to the first space application request, the method further includes: In response to the first target space being allocated, returning the first space application request to the distributed storage system client based on the first metadata server; When receiving the first space application request returned by the first metadata server, the distributed storage system client defines the first target space as a first file header.

5. The data pool management method according to claim 2 or 4, characterized in that: After defining the first target space as a first file header, the method further includes: Clear the content stored in the second file header of the distributed storage system client.

6. The data pool management method according to claim 1, characterized in that: Before adjusting the second file header of the target file and the content in the second file header according to the second file truncation request, the method further includes: Obtaining the truncated file size and the first file header in the second file truncation request; Based on the truncated file size, a target adjustment mechanism is determined to adjust the second file header of the target file and the content in the second file header based on the target adjustment mechanism and the first file header.

7. The data pool management method according to claim 6, characterized in that: Based on the truncated file size, determining a target adjustment mechanism includes: In response to the truncated file size being a target value, determining the target adjustment mechanism to be a first target adjustment mechanism; In response to the truncated file size not being a target value, determining the target adjustment mechanism to be a second target adjustment mechanism.

8. The data pool management method according to claim 7, characterized in that: Adjusting the second file header of the target file and the content in the second file header based on the first target adjustment mechanism and the first file header includes: The second file header of the target file is replaced with the first file header as the current file header of the target file, and the data block corresponding to the second file header is added to the release queue. At the same time, the second file truncation request is returned to the distributed storage system client.

9. The data pool management method according to claim 7, characterized in that: Before adjusting the second file header of the target file and the content in the second file header based on the second target adjustment mechanism and the first file header, the method further includes: Based on the background thread, read the data block corresponding to the second file header, and write the data block corresponding to the second file header into the object storage to the metadata pool; In response to the completion of writing the object, a record log is generated, wherein the record log includes the object name.

10. The data pool management method according to claim 7, characterized in that: Adjusting the second file header of the target file and the content in the second file header based on the second target adjustment mechanism and the first file header includes: Based on the background thread, read the data block corresponding to the second file header; According to the truncated file size, the data blocks corresponding to the second file header are divided into data blocks that need to be written back and data blocks that need to be released; The data block that needs to be written back is written back to the second file header, the data block that needs to be released is added to a release queue, and at the same time, the second file truncation request is returned to the distributed storage system client.

11. The data pool management method according to claim 10, characterized in that: In response to the second metadata server failing during the process of writing back the data block, the method further includes: Performing fault recovery on the second metadata server; In response to the second metadata server failure being recovered, reading the target record log; According to the object name in the target record log, the data block corresponding to the object name is read, and the data block corresponding to the object name is rewritten back to the second file header.

12. The data pool management method according to claim 10, characterized in that: The method further comprises: Detecting whether there is a need to save the data block to be written back based on the first file header; In response to there being no need to save the data block that needs to be written back based on the first file header, the first file header is added to a release queue.

13. The data pool management method according to claim 8 or 10, characterized in that: The method further comprises: In response to the distributed storage system client receiving the second file truncation request returned by the second metadata server, determining that the second file truncation request has been processed; In response to the second file truncation request having been processed, sending the adjustment result of the second file header to multiple distributed storage system clients based on the second metadata server; When receiving the adjustment result of the second file header, the multiple distributed storage system clients synchronously adjust the second file header and the content in the second file header stored in the corresponding distributed storage system clients.

14. The data pool management method according to claim 8, 10 or 12, characterized in that: According to the adjustment result, releasing the corresponding storage space includes: Obtain the release queue; Determine the storage space occupied by the data block and / or the first file header in the release queue, and release the storage space.

15. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 14 is implemented.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 14 is implemented.

17. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Database management method and database system

    CN108319602A

  • File merging method and device

    CN108319625A

  • Data processing method and terminal device of log file

    CN108829345A

  • File aggregation compatible method and device, computer equipment and storage medium

    CN113704027A

  • File truncation method and device for distributed file system and storage medium

    CN118170726A