A method, system, device and storage medium for deleting directory items
By writing the metadata information of the directory items to be deleted in the free directory in a distributed file system to the log file and dropping it into the disk, the metadata of the files in the free directory is solved, and the problem of excessive memory occupancy of files and long failover time in the free directory is achieved, and better deletion control and stability are achieved.
Patent Information
- Application Number
- CN202110929378.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-13
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2041-08-13
AI Technical Summary
In a distributed file system, files in free directories occupy too much memory, resulting in node memory exhaustion, affecting the normal operation of services, and the free directories need to be loaded during failover, resulting in a long time.
After writing the metadata information of the directory item to be deleted in the free directory to the log file and dropping it off, delete the metadata of the files in the free directory. When deleting a file, read the metadata information in the log file and parse it, and control the reading of the file metadata entries in the log file to achieve better deletion control.
It solves the problem that files occupy too much memory in free directories, reduces the failover time, improves the control and stability of the deletion operation, and thus enhances the market competitiveness of the product.
Smart Images

Figure CN113704193B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of distributed file systems, and more specifically, to a method, system, device and storage medium for deleting directory entries. Background Art
[0002] At present, distributed file systems are used to store massive amounts of data. When massive files are deleted, the following problems arise: ① Due to the large amount of deleted data, untimely flow control and poor results lead to excessive pressure on the storage pool, affecting other businesses, such as read and write operations; ② The deleted files enter the free directory, causing the mds (meta data server) to occupy too much memory, and even causing node memory exhaustion, posing potential risks; ③ When the node is restarted or the mds is restarted abnormally, it is necessary to wait for the free directory to be loaded before providing services to the outside world. Due to the large number of files in the free directory, it takes a long time to load from the disk, affecting normal business. Summary of the invention
[0003] In view of this, the purpose of the embodiments of the present invention is to propose a method, system, computer device and computer-readable storage medium for deleting directory entries. When the metadata information of the file in the free directory is written into the log file and stored on the disk, the metadata of the file in the free directory will be deleted. When deleting the file, it is only necessary to read and parse the metadata information in the log file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, the free directory does not need to be loaded, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product.
[0004] Based on the above-mentioned purpose, one aspect of an embodiment of the present invention provides a method for deleting directory entries, comprising the following steps: filling the directory entries to be deleted in the free directory into the corresponding structure, encoding the structure, and writing the encoded structure into a log file in the form of an event; deleting the metadata of the directory entries to be deleted, adding a storage thread outside the current thread, and judging whether the flow control parameters meet the preset requirements; in response to the flow control parameters meeting the preset requirements, reading each event in the log file in turn; and putting the information of the directory entries to be deleted corresponding to each of the events into the storage thread, and deleting the actual content of the directory entries to be deleted.
[0005] In some implementations, encoding the structure includes: converting metadata of the directory entry to be deleted into a binary stream.
[0006] In some implementations, determining whether the flow control parameter meets a preset requirement includes determining whether at least one of the first flow control parameter and the second flow control parameter is less than a preset threshold.
[0007] In some implementations, the method further includes: in response to each time an event in the log file is read, increasing the first flow control parameter by one, and adjusting the second flow control parameter according to the type of directory entry to be deleted corresponding to the event.
[0008] In some embodiments, adjusting the second flow control parameter according to the type of directory entry to be deleted corresponding to the event includes: determining whether the type of directory entry to be deleted corresponding to the read event is a file or a directory; in response to the type of directory entry to be deleted being a file, increasing the second flow control parameter by the number of objects occupied by the file; and in response to the type of directory entry to be deleted being a directory, increasing the second flow control parameter by the sum of the directory and all directory fragments.
[0009] In some implementations, the method further includes: in response to completion of deletion of actual content of the directory entry to be deleted, reducing the first flow control parameter by one, and adjusting the second flow control parameter according to the type of the directory entry to be deleted.
[0010] In some implementations, the method further includes: in response to completion of deletion of actual contents of the to-be-deleted directory item, deleting an invalid log file according to a location of an event corresponding to the to-be-deleted directory item being read.
[0011] Another aspect of an embodiment of the present invention provides a system for deleting directory entries, including: an encoding module, configured to fill the directory entries to be deleted in the free directory into a corresponding structure, encode the structure, and write the encoded structure into a log file in the form of an event; a judgment module, configured to delete the metadata of the directory entries to be deleted, add a storage thread outside the current thread, and judge whether the flow control parameters meet the preset requirements; a reading module, configured to read each event in the log file in turn in response to the flow control parameters meeting the preset requirements; and an execution module, configured to put the information of the directory entries to be deleted corresponding to each of the events into the storage thread, and delete the actual content of the directory entries to be deleted.
[0012] According to another aspect of an embodiment of the present invention, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores computer instructions executable on the processor, and the instructions implement the steps of the above method when executed by the processor.
[0013] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.
[0014] The present invention has the following beneficial technical effects: when the metadata information of the file in the free directory is written into the log file and stored in the disk, the metadata of the file in the free directory will be deleted. When deleting the file, it is only necessary to read and parse the metadata information in the log file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, it is not necessary to load the free directory, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0016] Figure 1 A schematic diagram of an embodiment of a method for deleting a directory entry provided by the present invention;
[0017] Figure 2 A schematic diagram of an embodiment of a system for deleting directory entries provided by the present invention;
[0018] Figure 3 A schematic diagram of the hardware structure of an embodiment of a computer device for deleting directory entries provided by the present invention;
[0019] Figure 4 A schematic diagram of an embodiment of a computer storage medium for deleting directory entries provided by the present invention. DETAILED DESCRIPTION
[0020] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0021] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.
[0022] A first aspect of the embodiments of the present invention provides an embodiment of a method for deleting a directory entry. Figure 1 FIG. 2 is a schematic diagram of an embodiment of a method for deleting a directory entry provided by the present invention. Figure 1 As shown, the embodiment of the present invention includes the following steps:
[0023] S1. Fill the directory entry to be deleted in the free directory into the corresponding structure, encode the structure, and write the encoded structure into a log file in the form of an event;
[0024] S2. Delete the metadata of the directory entry to be deleted, add a storage thread outside the current thread, and determine whether the flow control parameters meet the preset requirements;
[0025] S3. In response to the flow control parameter meeting the preset requirement, reading each event in the log file in sequence; and
[0026] S4. Put the information of the directory entry to be deleted corresponding to each of the events into the storage thread, and delete the actual content of the directory entry to be deleted.
[0027] The embodiment of the present invention adopts the method of recording log files to delete metadata and data separately. When the metadata information of the file in the free directory is written into the log file and stored on the disk, the metadata of the file in the free directory will be deleted. When deleting the file, it is only necessary to read and parse the metadata information in the log file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, the free directory does not need to be loaded, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product.
[0028] The directory entries entering the free directory are evaluated. The evaluation mainly includes: whether the dentry (directory entry) is a copy, whether the reference count of the inode (index node) meets the preset requirements, whether the link (connection) value of the file's inode is zero, etc. If one of them does not meet the preset requirements, it will not be deleted. Dentry represents a directory entry. The most important data stored in the directory entry is the name of the directory entry and the index node corresponding to the directory entry. Inode represents the index node information of the file system. The index node contains the unique number (index node number) of the metadata item in the file system, as well as related attributes (modification time, etc.) and extended attribute information.
[0029] Fill the directory items to be deleted in the free directory into the corresponding structure, encode the structure, and write the encoded structure into the log file in the form of an event. Fill the directory items (files and / or directories) to be deleted into the corresponding structure (the structure represents the key information of deleting files or directories), and the filled content is the inode number, timestamp, path before deletion, deletion type, file size, directory fragment number (unique to the directory), file layout information, etc.
[0030] In some embodiments, encoding the structure includes: converting the metadata of the directory entry to be deleted into a binary stream. Encoding the corresponding structure and then writing it into a journal file. The main purpose of the encoding operation is to convert the metadata of the file to be deleted into a binary stream and write it into the journal file.
[0031] Delete the metadata of the directory entry to be deleted, add a storage thread outside the current thread, and determine whether the flow control parameters meet the preset requirements. Delete the metadata of the file or directory (inode, dentry and other information), and add a thread outside the current thread to store the information of the directory entry to be deleted.
[0032] In some implementations, determining whether the flow control parameter meets the preset requirement includes: determining whether at least one of the first flow control parameter and the second flow control parameter is less than a preset threshold. As long as one of the first flow control parameter inflight and the second flow control parameter ops_reuqired is less than the preset threshold, the preset requirement is met.
[0033] In response to the flow control parameters meeting the preset requirements, each event in the log file is read in sequence. Each time an event in the journal is read, a decoding operation is performed to obtain a corresponding structure (key information for deleting a file or directory).
[0034] In some implementations, the method further includes: in response to each time an event in the log file is read, increasing the first flow control parameter by one, and adjusting the second flow control parameter according to the type of directory entry to be deleted corresponding to the event.
[0035] In some embodiments, adjusting the second flow control parameter according to the type of directory entry to be deleted corresponding to the event includes: determining whether the type of directory entry to be deleted corresponding to the read event is a file or a directory; in response to the type of directory entry to be deleted being a file, increasing the second flow control parameter by the number of objects occupied by the file; and in response to the type of directory entry to be deleted being a directory, increasing the second flow control parameter by the sum of the directory and all directory fragments.
[0036] Each time an event is read, the first flow control parameter inflight is increased by 1, and the second flow control parameter ops_reuqired is increased by ops. Ops calculation rule: If it is a file, ops is the number of objects occupied by the file; if it is a directory, ops is the sum of the directory and all directory fragments.
[0037] The information of the directory item to be deleted corresponding to each event is put into the storage thread, and the actual content of the directory item to be deleted is deleted. The information of the file or directory to be deleted is put into the newly added storage thread, and the file or directory calls different deletion delivery interfaces to delete the actual content. Until the log file is empty.
[0038] In some embodiments, the method further comprises: in response to the completion of deleting the actual content of the directory entry to be deleted, reducing the first flow control parameter by one, and adjusting the second flow control parameter according to the type of the directory entry to be deleted. After the deletion is completed, reducing the flow control parameter inflight by one, and reducing the flow control parameter ops_reuqired by the increased ops.
[0039] In some implementations, the method further includes: in response to completion of deletion of actual contents of the to-be-deleted directory item, deleting an invalid log file according to a location of an event corresponding to the to-be-deleted directory item.
[0040] The embodiment of the present invention adopts the method of recording log files to delete metadata and data separately. When the metadata information of the file in the free directory is written into the log file and stored on the disk, the metadata of the file in the free directory will be deleted. When deleting the file, it is only necessary to read and parse the metadata information in the log file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, the free directory does not need to be loaded, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product.
[0041] It should be pointed out in particular that the various steps in the various embodiments of the above-mentioned method for deleting directory entries can be cross-linked, replaced, added, and deleted. Therefore, these reasonable permutations, combinations and transformations of the method for deleting directory entries should also fall within the scope of protection of the present invention, and the scope of protection of the present invention should not be limited to the embodiments.
[0042] Based on the above purpose, the second aspect of the embodiment of the present invention provides a system for deleting directory entries. Figure 2As shown, the system 200 includes the following modules: an encoding module, configured to fill the directory items to be deleted in the free directory into the corresponding structure, encode the structure, and write the encoded structure into the log file in the form of an event; a judgment module, configured to delete the metadata of the directory items to be deleted, add a storage thread outside the current thread, and judge whether the flow control parameters meet the preset requirements; a reading module, configured to read each event in the log file in turn in response to the flow control parameters meeting the preset requirements; and an execution module, configured to put the information of the directory items to be deleted corresponding to each of the events into the storage thread, and delete the actual content of the directory items to be deleted.
[0043] In some implementations, the encoding module is configured to: convert the metadata of the directory entry to be deleted into a binary stream.
[0044] In some implementations, the determination module is configured to determine whether at least one of the first flow control parameter and the second flow control parameter is less than a preset threshold.
[0045] In some embodiments, the system further includes a counting module configured to: in response to each event read in the log file, increase the first flow control parameter by one, and adjust the second flow control parameter according to the type of directory entry to be deleted corresponding to the event.
[0046] In some embodiments, the counting module is configured to: determine whether the type of directory entry to be deleted corresponding to the read event is a file or a directory; in response to the type of directory entry to be deleted being a file, increase the second flow control parameter by the number of objects occupied by the file; and in response to the type of directory entry to be deleted being a directory, increase the second flow control parameter by the sum of the directory and all directory fragments.
[0047] In some embodiments, the system further includes an adjustment module configured to: in response to completion of deletion of actual content of the directory entry to be deleted, reduce the first flow control parameter by one, and adjust the second flow control parameter according to the type of the directory entry to be deleted.
[0048] In some implementations, the system further includes a deletion module configured to: in response to completion of deletion of actual contents of the to-be-deleted directory item, delete an invalid log file according to a location of an event corresponding to the to-be-deleted directory item.
[0049] In the embodiment of the present invention, when the metadata information of the file in the free directory is written into the log file and stored in the disk, the metadata of the file in the free directory will be deleted. It is only necessary to read and parse the metadata information in the log file when deleting the file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, the free directory does not need to be loaded, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product.
[0050] Based on the above purpose, the third aspect of an embodiment of the present invention proposes a computer device, comprising: at least one processor; and a memory, the memory storing computer instructions that can be run on the processor, the instructions being executed by the processor to implement the following steps: S1, filling the directory items to be deleted in the free directory into the corresponding structure, encoding the structure, and writing the encoded structure into a log file in the form of an event; S2, deleting the metadata of the directory items to be deleted, adding a storage thread outside the current thread, and judging whether the flow control parameters meet the preset requirements; S3, in response to the flow control parameters meeting the preset requirements, reading each event in the log file in turn; and S4, putting the information of the directory items to be deleted corresponding to each of the events into the storage thread, and deleting the actual content of the directory items to be deleted.
[0051] In some implementations, encoding the structure includes: converting metadata of the directory entry to be deleted into a binary stream.
[0052] In some implementations, determining whether the flow control parameter meets a preset requirement includes determining whether at least one of the first flow control parameter and the second flow control parameter is less than a preset threshold.
[0053] In some implementations, the steps further include: in response to each time an event in the log file is read, increasing the first flow control parameter by one, and adjusting the second flow control parameter according to the type of directory entry to be deleted corresponding to the event.
[0054] In some embodiments, adjusting the second flow control parameter according to the type of directory entry to be deleted corresponding to the event includes: determining whether the type of directory entry to be deleted corresponding to the read event is a file or a directory; in response to the type of directory entry to be deleted being a file, increasing the second flow control parameter by the number of objects occupied by the file; and in response to the type of directory entry to be deleted being a directory, increasing the second flow control parameter by the sum of the directory and all directory fragments.
[0055] In some implementations, the steps further include: in response to completion of deletion of actual contents of the directory entry to be deleted, reducing the first flow control parameter by one, and adjusting the second flow control parameter according to the type of the directory entry to be deleted.
[0056] In some implementations, the steps further include: in response to completion of deletion of actual contents of the to-be-deleted directory item, deleting an invalid log file according to a location of an event corresponding to the to-be-deleted directory item.
[0057] In the embodiment of the present invention, when the metadata information of the file in the free directory is written into the log file and stored in the disk, the metadata of the file in the free directory will be deleted. It is only necessary to read and parse the metadata information in the log file when deleting the file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, the free directory does not need to be loaded, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product.
[0058] like Figure 3 FIG. 1 is a schematic diagram of the hardware structure of an embodiment of the computer device for deleting directory entries provided by the present invention.
[0059] As Figure 3 Taking the device shown as an example, the device includes a processor 301 and a memory 302.
[0060] The processor 301 and the memory 302 may be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.
[0061] The memory 302 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the method for deleting directory items in the embodiment of the present application. The processor 301 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 302, that is, the method for deleting directory items in the above method embodiment is implemented.
[0062] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the method for deleting directory entries, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely arranged relative to the processor 301, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0063] Computer instructions 303 corresponding to one or more methods of deleting directory entries are stored in the memory 302. When executed by the processor 301, the method of deleting directory entries in any of the above method embodiments is executed.
[0064] In the embodiment of the present invention, when the metadata information of the file in the free directory is written into the log file and stored in the disk, the metadata of the file in the free directory will be deleted. It is only necessary to read and parse the metadata information in the log file when deleting the file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, the free directory does not need to be loaded, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product.
[0065] Any embodiment of a computer device that executes the above-mentioned method for deleting directory entries can achieve the same or similar effect as any corresponding embodiment of the above-mentioned method.
[0066] The present invention also provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, performs the above method for deleting directory entries.
[0067] like Figure 4 FIG. 1 is a schematic diagram of an embodiment of the computer storage medium for deleting directory entries provided by the present invention. Figure 4 Taking the computer storage medium shown as an example, the computer readable storage medium 401 stores a computer program 402 that performs the above method when executed by a processor.
[0068] In the embodiment of the present invention, when the metadata information of the file in the free directory is written into the log file and stored in the disk, the metadata of the file in the free directory will be deleted. It is only necessary to read and parse the metadata information in the log file when deleting the file, which solves the problem of excessive memory occupation by the files in the free directory. At the same time, when the fault is switched, the free directory does not need to be loaded, which solves the problem of long fault switching time. By controlling the reading of the file metadata entries in the log file, the deletion can be better controlled, which greatly enhances the stability and market competitiveness of the product.
[0069] Finally, it should be noted that a person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program of the method for deleting directory entries can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as the corresponding above-mentioned arbitrary method embodiments.
[0070] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0071] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0072] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0073] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0074] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for deleting a directory entry, characterized in that: The steps include: Fill the directory entry to be deleted in the free directory into the corresponding structure, encode the structure, and write the encoded structure into the log file in the form of an event; The metadata of the directory entry to be deleted is deleted, a storage thread is added outside the current thread, and it is determined whether the flow control parameters meet the preset requirements; In response to the flow control parameter meeting the preset requirement, reading each event in the log file in sequence; as well as Putting information of the directory entry to be deleted corresponding to each of the events into the storage thread, and deleting the actual content of the directory entry to be deleted; The encoding of the structure comprises: Converting the metadata of the directory entry to be deleted into a binary stream; In response to the flow control parameter meeting the preset requirement, reading each event in the log file in sequence, including: Each time an event in the log file is read, a decoding operation is performed to obtain the corresponding structure; Determining whether the flow control parameters meet the preset requirements includes: Determining whether at least one of the first flow control parameter and the second flow control parameter is less than a preset threshold; The method also includes: In response to each event read from the log file, the first flow control parameter is increased by one, and the second flow control parameter is adjusted according to the type of the directory entry to be deleted corresponding to the event; The adjusting the second flow control parameter according to the type of the directory entry to be deleted corresponding to the event includes: Determine whether the type of the directory entry to be deleted corresponding to the read event is a file or a directory; In response to the type of the directory entry to be deleted being a file, increasing the second flow control parameter by the number of objects occupied by the file; and In response to the type of the directory entry to be deleted being a directory, the second flow control parameter is increased by the sum of the directory and all directory fragments.
2. The method according to claim 1, characterized in that The method also includes: In response to completion of deletion of the actual content of the directory entry to be deleted, the first flow control parameter is reduced by one, and the second flow control parameter is adjusted according to the type of the directory entry to be deleted.
3. The method according to claim 1, characterized in that The method also includes: In response to the completion of deleting the actual content of the directory entry to be deleted, the invalid log file is deleted according to the position of the event corresponding to the directory entry to be deleted.
4. A system for deleting directory entries, characterized in that: include: An encoding module configured to fill the directory entry to be deleted in the free directory into a corresponding structure, encode the structure, and write the encoded structure into a log file in the form of an event; The encoding module is configured to: convert the metadata of the directory entry to be deleted into a binary stream; A judgment module is configured to delete the metadata of the directory entry to be deleted, add a storage thread outside the current thread, and judge whether the flow control parameters meet the preset requirements; The method of judging whether the flow control parameter meets the preset requirements includes: judging whether at least one of the first flow control parameter and the second flow control parameter is less than a preset threshold; the method also includes: in response to each event read in the log file, increasing the first flow control parameter by one, and adjusting the second flow control parameter according to the type of the directory item to be deleted corresponding to the event; the method of adjusting the second flow control parameter according to the type of the directory item to be deleted corresponding to the event includes: judging whether the type of the directory item to be deleted corresponding to the read event is a file or a directory; in response to the type of the directory item to be deleted being a file, increasing the second flow control parameter by the number of objects occupied by the file; and in response to the type of the directory item to be deleted being a directory, increasing the second flow control parameter by the sum of the directory and all directory fragments; A reading module configured to read each event in the log file in sequence in response to the flow control parameter meeting the preset requirement; the reading module is configured to: read an event in the log file each time, perform a decoding operation, and obtain a corresponding structure; and The execution module is configured to put the information of the directory entry to be deleted corresponding to each of the events into the storage thread, and delete the actual content of the directory entry to be deleted.
5. A computer device, characterized in that: include: at least one processor; as well as A memory, wherein the memory stores computer instructions executable on the processor, wherein the instructions, when executed by the processor, implement the steps of the method according to any one of claims 1 to 3.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Operation method and system based on metadata
CN107590271A
Method and device for deleting files in batches and electronic equipment
CN111078643A