CN111737209A - File cleaning method and related equipment thereof - Google Patents

File cleaning method and related equipment thereof Download PDF

Info

Publication number
CN111737209A
CN111737209A CN202010579792.8A CN202010579792A CN111737209A CN 111737209 A CN111737209 A CN 111737209A CN 202010579792 A CN202010579792 A CN 202010579792A CN 111737209 A CN111737209 A CN 111737209A
Authority
CN
China
Prior art keywords
file
cleaning
information
cleaned
files
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010579792.8A
Other languages
Chinese (zh)
Inventor
王子翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Onething Technology Co Ltd
Original Assignee
Shenzhen Onething Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Onething Technology Co Ltd filed Critical Shenzhen Onething Technology Co Ltd
Priority to CN202010579792.8A priority Critical patent/CN111737209A/en
Publication of CN111737209A publication Critical patent/CN111737209A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a file cleaning method, which comprises the steps of obtaining a file cleaning instruction; reading ATIME information of each cache file in a metadata base according to the file cleaning instruction; sequencing each cache file according to the ATIME information, and determining files to be cleaned according to a preset cleaning proportion; and deleting the file to be cleaned. The invention also discloses file cleaning equipment, a file cleaning device, a computer readable storage medium and a computer program product. The technical scheme of the invention can effectively get rid of the dependence on the file system, further more accurately screen out files with lower popularity, and avoid the problems of file mistaken deletion and service node service performance reduction.

Description

File cleaning method and related equipment thereof
Technical Field
The present invention relates to the field of file management technologies, and in particular, to a file cleaning method, a file cleaning apparatus, a file cleaning device, a computer-readable storage medium, and a computer program product.
Background
The CDN (Content Delivery Network) system mainly includes a scheduling module, a service node module, and an SDK module, where the service node module refers to numerous service nodes distributed across the country and is responsible for caching files and providing services for the SDK installed in a client device, and since a disk and a memory space of each service node are limited, as new heat files are continuously deployed to the service node, the total size of the cache files gradually increases, and when the total size exceeds a certain threshold, existing cache files need to be cleaned.
The traditional file cleaning is realized based on the last Access Time (ATIME) of a cache file, namely, a file system is traversed to read the ATIMEs of all files, and then a certain number of files with the smallest ATIMEs are screened and cleaned according to the ATIME sorting of the files. However, because some file systems do not update the ATIME of the file in real time due to performance considerations, or even do not update the ATIME at all, the ATIME relying on the file system cannot accurately screen out files with low popularity, resulting in some files with high popularity being deleted by mistake; moreover, since the ATIME acquisition depends on the file system, all files in the entire storage directory need to be traversed, which will bring a large pressure on the CPU and the disk IO and affect the service performance of the service node.
Therefore, how to more accurately screen out and clean files with lower popularity on the premise of not affecting the service performance of the service node and avoid the mistaken deletion of the files is a problem to be solved by those skilled in the art.
Disclosure of Invention
The invention mainly aims to provide a file cleaning method, a device, a computer readable storage medium and a computer program product, aiming at solving the problems that in the prior art, due to the fact that ATIME acquisition is realized by depending on a file system, a hot file is deleted by mistake and the service performance of a service node is influenced.
In order to achieve the above object, the present invention provides a file cleaning method, including:
acquiring a file cleaning instruction;
reading ATIME information of each cache file in a metadata base according to the file cleaning instruction;
sequencing each cache file according to the ATIME information, and determining files to be cleaned according to a preset cleaning proportion;
and deleting the file to be cleaned.
Preferably, the acquiring of the file cleaning instruction includes:
acquiring available space of a file storage space;
determining whether the available space is below a first threshold;
and if so, responding to the file cleaning instruction.
Preferably, the acquiring of the file cleaning instruction includes:
reading file size information of each cache file in the metadata database;
calculating and obtaining the occupied space of the file storage space according to the size information of each file;
judging whether the occupied space exceeds a second threshold value;
and if so, responding to the file cleaning instruction.
Preferably, the sorting each cache file according to the ATIME information and determining the file to be cleaned according to a preset cleaning ratio includes:
sorting each cache file according to the ATIME information, and determining candidate files to be cleaned according to a first preset cleaning proportion;
reading HB information of each candidate file to be cleaned in the metadata base;
and sequencing each candidate file to be cleaned according to the HB information, and determining the file to be cleaned according to a second preset cleaning proportion.
Preferably, after deleting the file to be cleaned, the method further includes:
and deleting the metadata corresponding to the file to be cleaned in the metadata database.
Preferably, the file cleaning method further includes:
and counting file cleaning information, and uploading the file cleaning information to a central server.
To achieve the above object, the present invention provides a file cleaning device, which includes a memory and a processor, wherein the memory stores a file cleaning program capable of running on the processor, and the file cleaning program, when executed by the processor, implements the steps of the file cleaning method as described in any one of the above.
To achieve the above object, the present invention provides a document cleaning apparatus, comprising:
the instruction acquisition module is used for acquiring a file cleaning instruction;
the information reading module is used for reading ATIME information of each cache file in the metadata base according to the file cleaning instruction;
the file sorting module is used for sorting each cache file according to the ATIME information and determining files to be cleaned according to a preset cleaning proportion;
and the file deleting module is used for deleting the file to be cleaned.
To achieve the above object, the present invention provides a computer-readable storage medium having stored thereon a file cleaning program, the file cleaning program being executable by one or more processors to implement the steps of the file cleaning method as described in any one of the above.
To achieve the above object, the present invention provides a computer program product comprising computer instructions which, when run on a computer, enable the computer to perform the steps of any of the file cleaning methods described above.
The invention provides a file cleaning method, which comprises the steps of obtaining a file cleaning instruction; reading ATIME information of each cache file in a metadata base according to the file cleaning instruction; sequencing each cache file according to the ATIME information, and determining files to be cleaned according to a preset cleaning proportion; and deleting the file to be cleaned. Therefore, the technical scheme provided by the invention has the advantages that the metadata base is established in advance, and the metadata of the deployment files such as ATIME information and the like are stored in the metadata base in the file deployment stage, so that the ATIME information of each cache file can be directly obtained from the metadata base when the files are cleaned, the file sorting and the file cleaning are completed, the dependence on a file system is effectively eliminated, and the influence of excessive file traversal on the service performance of a service node is avoided; moreover, the metadata base can realize the real-time recording of the ATIME information, so that the real-time updating of the ATIME information is ensured, the screened files to be cleaned are effectively ensured to be low-heat files, and the problem of mistaken deletion of the files is avoided.
The file cleaning device, the file cleaning apparatus, the computer readable storage medium and the computer program product provided by the present invention all have the above beneficial effects, and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a schematic flow chart of a first embodiment of the present invention;
FIG. 2 is a schematic flow chart of a second embodiment of the present invention;
FIG. 3 is a schematic flow chart of a third embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating an internal structure of a document cleaning apparatus according to a first embodiment of the present invention;
fig. 5 is a schematic structural diagram of a fourth embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
The invention provides a file cleaning method.
Referring to fig. 1, fig. 1 is a schematic flow chart of a first embodiment of the present invention.
In a first embodiment, the method may comprise:
s10: and acquiring a file cleaning instruction.
The step aims to realize the acquisition of the file cleaning instruction so as to realize the file cleaning by executing the file cleaning instruction. It can be understood that the obtaining manner of the file cleaning instruction does not affect the implementation of the technical scheme, and the file cleaning instruction can be issued by a technician through a user terminal according to actual requirements, or can automatically respond based on preset trigger conditions, such as timing conditions, and the like, which is not limited in the present application.
As a preferred embodiment, the obtaining of the file cleaning instruction may include: acquiring available space of a file storage space; determining whether the available space is below a first threshold; and if so, responding to the file cleaning instruction.
The preferred embodiment provides a more specific method for acquiring a file cleaning instruction, that is, the method is implemented based on an available space of a file storage space, where the file storage space is a storage space used for storing a deployed file in a service node, and the available space is a usable storage space left after the file storage space completes file deployment. Specifically, the available space of the file storage space can be detected in real time or at regular time, and when the available space is lower than a first threshold value, a file cleaning instruction is automatically responded. Of course, the specific value of the first threshold is not unique, and may be set according to an actual situation, such as specific performance of the service node, which is not limited in the present application.
As a preferred embodiment, the obtaining of the file cleaning instruction may include: reading file size information of each cache file in a metadata base; calculating and obtaining the occupied space of the file storage space according to the size information of each file; judging whether the occupied space exceeds a second threshold value; and if so, responding to the file cleaning instruction.
The preferred embodiment provides another specific method for acquiring the file cleaning instruction, that is, the method is implemented based on the occupied space of the file storage space, and of course, the occupied space is the space occupied by the deployed file in the file storage space, that is, the total file size. Specifically, the occupied space of the file storage space can be counted in real time or at regular time, and when the occupied space exceeds the second threshold, the file cleaning instruction is automatically responded. Similarly, the specific value of the second threshold is not limited in this application. Further, when occupied space statistics is performed, file size information of each cache file can be directly read from a metadata base, the metadata base is a database which is created in advance and used for storing metadata information of each cache file, the metadata information of the deployed files can be directly stored into the metadata base in a file deployment stage so as to be convenient for information query and calling, therefore, the total file size can be calculated and obtained by reading the obtained file size information of each cache file, and the occupied space is also determined. It is conceivable that, by directly reading the file size information in the metadata base, the process of traversing all the cache files in the file system can be effectively avoided, the pressure of a CPU and a disk IO in the service node is reduced, and the service performance of the service node is guaranteed not to be affected.
S11: and reading the ATIME information of each cache file in the metadata base according to the file cleaning instruction.
The step aims to realize the acquisition of ATIME information of each cache file, and the information can be acquired based on a metadata database. Specifically, a metadata base is established in advance, and metadata of a deployment file such as ATIME information is stored in the metadata base in a file deployment phase. Since the metadata database stores the metadata information of each cache file, the corresponding ATIME information can be directly read from each metadata. Similarly, the ATIME information is directly read from the metadata base, so that the process of traversing all cache files in a file system can be effectively avoided, the pressure of a CPU (Central processing Unit) and a disk IO (input/output) in a service node is reduced, and the service performance of the service node is not influenced; moreover, the metadata base can record the ATIME information in real time, real-time updating of the ATIME information can be effectively guaranteed, files to be cleaned can be conveniently and accurately screened, and therefore the situation that high-heat files are mistakenly deleted is avoided.
S12: and sequencing the cache files according to the ATIME information, and determining the files to be cleaned according to a preset cleaning proportion.
The step aims to realize file sorting, namely sorting all cache files in the file storage space according to ATIME information from small to large or from large to small, and selecting a part of cache files with the smallest ATIME as files to be cleaned according to a preset cleaning proportion. The value of the preset cleaning proportion is not unique, and the value is set according to the actual performance of the service node, which is not limited in the application. It can be understood that negative effects are caused by too low and too high proportions of cleaning the cache files, and the too low proportion of cleaning the cache files can cause the file cleaning speed to not catch up with the file deployment speed, so that the disk use space still exceeds the second threshold; the too high proportion of the cleaning cache files can cause that some files which can be served externally are cleaned, and the amplification ratio of the files (byte number of the served externally/byte number of the deployed files) and the uplink service running amount of the service node are reduced. In the prior art, files are mostly cleaned according to the fixed file quantity, the conditions that the proportion of cleaning cache files is too low and too high easily occur, and the problem is well solved by presetting the cleaning proportion.
S13: and deleting the file to be cleaned.
The step aims to realize file cleaning, and the file to be cleaned is directly deleted after the determination is finished.
As a preferred embodiment, after deleting the file to be cleaned, the method may further include: and deleting the metadata corresponding to the file to be cleaned in the metadata database.
The preferred embodiment is directed to enabling deletion of metadata of files to be cleaned. Specifically, after the deletion of the file to be cleaned is completed, the metadata stored in the metadata database can be further deleted, so that unnecessary space occupation is avoided, a storage space is provided for the metadata of a new cache file, and the influence on metadata information query can be reduced to a certain extent.
As a preferred embodiment, the file cleaning method may further include: and counting file cleaning information, and uploading the file cleaning information to a central server.
The preferred embodiment aims to realize the upper and lower levels of synchronization of the related information of the cache files. Specifically, the CDN system mainly includes a scheduling module, a service node module, and an SDK module, where the scheduling module is a central server cluster of the CDN system and is responsible for functions such as file indexing, heat calculation, file deployment, and service scheduling, the service node module corresponds to a myriad of small service nodes distributed all over the country and is responsible for file caching and providing services to a user side installed with the SDK, and the user side is a consumer that caches files. Therefore, after the file cleaning is finished, the cleaning information can be further counted and uploaded to a central server, namely a scheduling module.
The file cleaning method provided by the embodiment is characterized in that a metadata base is established in advance, and metadata of deployment files such as ATIME information and the like are stored in the metadata base in a file deployment stage, so that when the files are cleaned, the ATIME information of each cache file can be directly acquired from the metadata base, and file sorting and file cleaning are completed, so that the dependence on a file system is effectively eliminated, and the influence of excessive file traversal on service performance of a service node is avoided; moreover, the metadata base can realize the real-time recording of the ATIME information, so that the real-time updating of the ATIME information is ensured, the screened files to be cleaned are effectively ensured to be low-heat files, and the problem of mistaken deletion of the files is avoided.
The invention provides another file cleaning method.
Referring to fig. 2, fig. 2 is a schematic flow chart of a second embodiment of the present invention.
In a second embodiment, the method may comprise:
s20: and acquiring a file cleaning instruction.
S21: and reading the ATIME information of each cache file in the metadata base according to the file cleaning instruction.
S22: and sequencing the cache files according to the ATIME information, and determining candidate files to be cleaned according to a first preset cleaning proportion.
S23: and reading the information of the total byte number (HB) of each candidate file to be cleaned in the metadata base.
S24: and sequencing the candidate files to be cleaned according to the HB information, and determining the files to be cleaned according to a second preset cleaning proportion.
S25: and deleting the file to be cleaned.
The embodiment of the application provides a more specific file cleaning method, which combines ATIME information and HB information of a cache file to realize screening of a file to be cleaned and further complete file cleaning, wherein HB refers to the total number of bytes of the cache file which are externally served within a past period of time, and has a certain positive correlation with the file heat.
Specifically, a part of candidate files to be cleaned are screened out from all cache files based on ATIME information, then files to be cleaned are screened out from all candidate files to be cleaned based on HB information, and finally the files to be cleaned are deleted. The screening of the candidate files to be cleaned and the files to be cleaned can be realized based on a certain cleaning proportion, namely the first preset cleaning proportion and the second preset cleaning proportion, firstly, the cache files are sorted according to the sequence from small ATIME to large ATIME, the cache files with the first preset cleaning proportion and small ATIME values are selected as the candidate files to be cleaned, then, the candidate files to be cleaned are sorted according to the sequence from small HB to large HB, the candidate files to be cleaned with the second preset proportion and small HB values are selected as the candidate files to be cleaned, and then, the deletion of the files is completed. It can be understood that the first preset cleaning proportion and the second preset cleaning proportion may be obtained by calculation according to the preset cleaning proportion, or may be set directly according to an actual situation, which is not limited in the present application. For example, the product of the first preset cleaning proportion and the second preset cleaning proportion may be set to be equal to the preset cleaning proportion of the cache file to be actually cleaned, so as to ensure that the cleaned file proportion meets the predetermined requirement, and assuming that the actual cache file proportion to be cleaned is 10%, the first preset cleaning proportion may be set to be 20%, and the second preset cleaning proportion may be 50%, so as to ensure that the actual cleaned file proportion is 10%. Therefore, the files are cleaned by combining the ATIME information and the HB information, the files to be cleaned can be further ensured to be low-heat files at a high probability, and the mistaken deletion of the high-heat files is effectively avoided.
In addition, for the specific implementation steps of S20 to S21 and S25, reference may be made to the previous embodiment, and the detailed description of this embodiment is omitted here.
The invention provides a file cleaning method.
Referring to fig. 3, fig. 3 is a schematic flow chart of a third embodiment of the invention.
In a third embodiment, the method is implemented as follows:
firstly, real-time or timing check is carried out on a file cleaning triggering condition to determine whether file cleaning is needed, wherein the file cleaning triggering condition may include:
(1) set the minimum allowed remaining space MinDiskAvailGB (first threshold): if the residual space of the storage directory is less than MinDiskAvailGB, cleaning is triggered;
(2) set the maximum allowed usage space MaxDiskUsageGB (second threshold): if the used space of the storage directory > MaxDiskUsageGB, a clean-up is triggered.
Further, screening and deleting files to be cleaned, reading ATIME information and HB information of each cache file from a metadata base, and sorting each cache file according to the ATIME information to screen out candidate files to be cleaned, wherein in the embodiment of the application, the preset cleaning proportion is 10%, and the screening proportion of the candidate files to be cleaned is set to be 1.5 times of the preset cleaning proportion; and then, sequencing all candidate files to be cleaned according to the HB information, and taking the candidate files to be cleaned with lower HB and belonging to a preset cleaning proportion as the files to be cleaned and deleting the files.
And finally, reporting the statistical file deletion information to a central server so as to complete the upper and lower-level synchronization of file processing.
Therefore, the file cleaning method provided by the embodiment of the application establishes the metadata base in advance, and stores the metadata of the deployment files such as ATIME information and the like to the metadata base in the file deployment stage, so that the ATIME information of each cache file can be directly acquired from the metadata base when the files are cleaned, and file sorting and file cleaning are completed, the dependence on a file system is effectively eliminated, and the influence of excessive file traversal on the service performance of a service node is avoided; moreover, the metadata base can realize the real-time recording of the ATIME information, so that the real-time updating of the ATIME information is ensured, the screened files to be cleaned are effectively ensured to be low-heat files, and the problem of mistaken deletion of the files is avoided.
The invention provides file cleaning equipment.
Referring to fig. 4, fig. 4 is a schematic diagram of an internal structure of a document cleaning apparatus according to a first embodiment of the present invention.
The file cleaning device 1 may comprise a memory 11, a processor 12 and a bus 13.
The memory 11 includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 11 may in some embodiments be an internal storage unit of the file cleaning device 1, for example a hard disk of the file cleaning device 1. The memory 11 may also be an external storage device of the file cleaning device 1 in other embodiments, such as a plug-in hard disk provided on the file cleaning device 1, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 11 may also include both an internal storage unit of the file cleaning apparatus 1 and an external storage device. The memory 11 may be used not only to store application software installed in the file cleaning apparatus 1 and various types of data such as a code of a file cleaning program, etc., but also to temporarily store data that has been output or is to be output.
The processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 11 or Processing data, such as executing a file cleaning program.
The bus 13 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
Further, the file cleaning device 1 may further comprise a network interface, which may optionally comprise a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), and is generally used for establishing a communication connection between the file cleaning device 1 and other electronic devices.
Optionally, the file cleaning device 1 may further comprise a user interface, the user interface may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may further comprise a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the document cleaning apparatus 1 and for displaying a visual user interface.
While FIG. 4 shows only the document cleaning device 1 with components 11-13 and a document cleaning program, it will be understood by those skilled in the art that the structure shown in FIG. 4 does not constitute a limitation of the document cleaning device 1, and may include fewer or more components than shown, or some components in combination, or a different arrangement of components.
The invention provides a file cleaning device.
Referring to fig. 5, fig. 5 is a block diagram illustrating a fourth embodiment of the present invention.
In a fourth embodiment, the file cleaning apparatus may include:
an instruction obtaining module 100, configured to obtain a file cleaning instruction;
an information reading module 200, configured to read ATIME information of each cache file in the metadata base according to the file cleaning instruction;
the file sorting module 300 is configured to sort each cache file according to the ATIME information, and determine a file to be cleaned according to a preset cleaning ratio;
and the file deleting module 400 is used for deleting the file to be cleaned.
For the introduction of the apparatus provided in the present application, please refer to the above method embodiments, which are not described herein again.
Embodiments of the present invention also provide a computer-readable storage medium, on which a file cleaning program is stored, where the file cleaning program is executable by one or more processors to implement the steps of the file cleaning method according to any one of the above embodiments.
Embodiments of the present invention further provide a computer program product, where the computer program product includes computer instructions, which when run on a computer, enable the computer to perform the steps of the file cleaning method according to any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatus and system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus, system, and method may be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the units is only one logical functional division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method of file cleaning, the method comprising:
acquiring a file cleaning instruction;
reading ATIME information of each cache file in a metadata base according to the file cleaning instruction;
sequencing each cache file according to the ATIME information, and determining files to be cleaned according to a preset cleaning proportion;
and deleting the file to be cleaned.
2. The method of claim 1, wherein said obtaining file clean-up instructions comprises:
acquiring available space of a file storage space;
determining whether the available space is below a first threshold;
and if so, responding to the file cleaning instruction.
3. The method of claim 1, wherein said obtaining file clean-up instructions comprises:
reading file size information of each cache file in the metadata database;
calculating and obtaining the occupied space of the file storage space according to the size information of each file;
judging whether the occupied space exceeds a second threshold value;
and if so, responding to the file cleaning instruction.
4. The method of any one of claims 1 to 3, wherein the sorting each cache file according to the ATIME information and determining the files to be cleaned according to a preset cleaning proportion comprises:
sorting each cache file according to the ATIME information, and determining candidate files to be cleaned according to a first preset cleaning proportion;
reading HB information of each candidate file to be cleaned in the metadata base;
and sequencing each candidate file to be cleaned according to the HB information, and determining the file to be cleaned according to a second preset cleaning proportion.
5. The method of claim 1, wherein after deleting the file to be cleaned, further comprising:
and deleting the metadata corresponding to the file to be cleaned in the metadata database.
6. The method of claim 5, further comprising:
and counting file cleaning information, and uploading the file cleaning information to a central server.
7. A file cleaning device, characterized in that the file cleaning device comprises a memory and a processor, the memory having stored thereon a file cleaning program operable on the processor, the file cleaning program, when executed by the processor, implementing the steps of the file cleaning method according to any one of claims 1 to 6.
8. A document cleaning apparatus, the apparatus comprising:
the instruction acquisition module is used for acquiring a file cleaning instruction;
the information reading module is used for reading ATIME information of each cache file in the metadata base according to the file cleaning instruction;
the file sorting module is used for sorting each cache file according to the ATIME information and determining files to be cleaned according to a preset cleaning proportion;
and the file deleting module is used for deleting the file to be cleaned.
9. A computer-readable storage medium having stored thereon a file cleaning program executable by one or more processors to perform the steps of the file cleaning method of any one of claims 1 to 6.
10. A computer program product comprising computer instructions which, when run on a computer, cause the computer to perform the steps of the file cleaning method of any one of claims 1 to 6.
CN202010579792.8A 2020-06-23 2020-06-23 File cleaning method and related equipment thereof Pending CN111737209A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010579792.8A CN111737209A (en) 2020-06-23 2020-06-23 File cleaning method and related equipment thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010579792.8A CN111737209A (en) 2020-06-23 2020-06-23 File cleaning method and related equipment thereof

Publications (1)

Publication Number Publication Date
CN111737209A true CN111737209A (en) 2020-10-02

Family

ID=72650660

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010579792.8A Pending CN111737209A (en) 2020-06-23 2020-06-23 File cleaning method and related equipment thereof

Country Status (1)

Country Link
CN (1) CN111737209A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023273659A1 (en) * 2021-06-30 2023-01-05 华为技术有限公司 Cache file management method and apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473343A (en) * 2013-09-23 2013-12-25 深圳市金立通信设备有限公司 File management method, device and terminal
CN105867845A (en) * 2016-03-28 2016-08-17 乐视控股(北京)有限公司 Application storage space management method and device
CN106951550A (en) * 2017-03-27 2017-07-14 广东欧珀移动通信有限公司 Data processing method, device and mobile terminal
CN107943718A (en) * 2017-12-07 2018-04-20 网宿科技股份有限公司 A kind of method and apparatus for clearing up cache file
CN109614377A (en) * 2018-12-07 2019-04-12 浪潮电子信息产业股份有限公司 File delet method, device, equipment and the storage medium of distributed file system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473343A (en) * 2013-09-23 2013-12-25 深圳市金立通信设备有限公司 File management method, device and terminal
CN105867845A (en) * 2016-03-28 2016-08-17 乐视控股(北京)有限公司 Application storage space management method and device
CN106951550A (en) * 2017-03-27 2017-07-14 广东欧珀移动通信有限公司 Data processing method, device and mobile terminal
CN107943718A (en) * 2017-12-07 2018-04-20 网宿科技股份有限公司 A kind of method and apparatus for clearing up cache file
CN109614377A (en) * 2018-12-07 2019-04-12 浪潮电子信息产业股份有限公司 File delet method, device, equipment and the storage medium of distributed file system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
钟杨俊;吴为波;: "网格空间数据库副本优化算法比较与仿真试验", 江西理工大学学报, no. 03, 15 June 2010 (2010-06-15), pages 60 - 63 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023273659A1 (en) * 2021-06-30 2023-01-05 华为技术有限公司 Cache file management method and apparatus

Similar Documents

Publication Publication Date Title
US20150134913A1 (en) Method and apparatus for cleaning files in a mobile terminal and associated mobile terminal
CN109299144B (en) Data processing method, device and system and application server
CN111400308B (en) Processing method of cache data, electronic device and readable storage medium
CN110489063B (en) Method and device for setting cache expiration time, electronic equipment and storage medium
WO2020211236A1 (en) Read-write conflict resolution method and apparatus employing b+ tree and storage medium
CN109388671B (en) Data processing method, device, equipment and storage medium
CN110489405B (en) Data processing method, device and server
CN111277635B (en) Method, equipment, device and computer medium for accessing external node to block chain
CN110442773A (en) Distributed system interior joint caching method, system, device and computer media
CN110457255B (en) Method, server and computer readable storage medium for archiving data
CN110851334A (en) Flow statistical method, electronic device, system and medium
CN111198885A (en) Data processing method and device
CN111737209A (en) File cleaning method and related equipment thereof
CN111061802A (en) Power data management processing method and device and storage medium
CN111858612B (en) Data accelerated access method and device based on graph database and storage medium
CN113094248A (en) User behavior data analysis method and device, electronic equipment and medium
CN110874365B (en) Information query method and related equipment thereof
CN110008243B (en) Data table processing method and device
CN115277588B (en) Fusing current limiting system based on middle platform system
CN110855525A (en) Flow statistical method, electronic device, system and medium
CN116071123A (en) Commodity data processing method, commodity data processing system, electronic equipment and storage medium
CN111026613B (en) Log processing method and device
CN111131393B (en) User activity data statistical method, electronic device and storage medium
CN116737764A (en) Method and device for data synchronization, electronic equipment and storage medium
CN109446162B (en) Method and system for determining data state of target mobile terminal in mobile internet

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination