The disclosed implementations relate generally to the management of a file system, and in particular, to system and method for deleting obsolete files from a file system.
A file system in a computer system is used for managing data stored in a storage device. Typically, the data is organized into many data files and each data file is stored in a particular directory of the file system. Different data files in the file system usually operate on their own such that the addition or removal of one data file in the file system has little, if any, impact on the other data files. Compared with a file system, a database system also deals with a collection of data. But the data in the database system is often organized into many inter-related data records within one or more data structures (e.g., tables). In response to a query, the database system identifies within different tables a set of data records that satisfy the query and return the set of records or a derivative thereof as a response to the query. Similarly, the deletion of a data record from one table may trigger the deletion of a data record from another table. Currently, the line separating the file system from the database system is becoming increasingly blurry because data records in the database system often include references or pointers to different data files in the file system. As a result, an update to the database system may cause an update to the file system.
In accordance with some implementations described below, a method performed by a computer server for deleting obsolete files from a file system is provided. The method includes: receiving a request to delete a reference to a target file in a file system from a file reference data structure, wherein the file reference data structure includes a plurality of target file names and a plurality of reference file names; identifying a reference file name in the file reference data structure, wherein the reference file name includes a file name of the target file in the file system; deleting a reference file from the file system, wherein the reference file has the identified reference file name; checking whether the file system includes at least one reference file whose file name matches the file name of the target file in the file system; if there is no such reference file in the file system: deleting the target file from the file system; and deleting the file name of the target file in the file system from the file reference data structure.
In accordance with some implementations described below, a computer system for deleting obsolete files from a file system includes one or more processors; memory; and a plurality of program modules, wherein the plurality of program modules are stored in the memory and to be executed by the one or more processors. The plurality of program modules include instructions for: receiving a request to delete a reference to a target file in a file system from a file reference data structure, wherein the file reference data structure includes a plurality of target file names and a plurality of reference file names; identifying a reference file name in the file reference data structure, wherein the reference file name includes a file name of the target file in the file system; deleting a reference file from the file system, wherein the reference file has the identified reference file name; checking whether the file system includes at least one reference file whose file name matches the file name of the target file in the file system; if there is no such reference file in the file system: deleting the target file from the file system; and deleting the file name of the target file in the file system from the file reference data structure.
In accordance with some implementations described below, a non-transitory computer readable-storage medium stores one or more programs for execution by one or more processors of a computer system that includes one or more processors and memory for deleting obsolete files from a file system. The one or more program modules include instructions: receiving a request to delete a reference to a target file in a file system from a file reference data structure, wherein the file reference data structure includes a plurality of target file names and a plurality of reference file names; identifying a reference file name in the file reference data structure, wherein the reference file name includes a file name of the target file in the file system; deleting a reference file from the file system, wherein the reference file has the identified reference file name; checking whether the file system includes at least one reference file whose file name matches the file name of the target file in the file system; if there is no such reference file in the file system: deleting the target file from the file system; and deleting the file name of the target file in the file system from the file reference data structure.
The aforementioned implementation of the invention as well as additional implementations will be more clearly understood as a result of the following detailed description of the various aspects of the invention when taken in conjunction with the drawings. Like reference numerals refer to corresponding parts throughout the several views of the drawings.
As a distributed storage system, the system 100 may include multiple data centers located at different geographic regions (e.g., one on the East Coast of the United States and another one on the West Coast of the United States) or even across the world. A data access request submitted to the distributed storage system 100 is received and processed by one of the servers 110 (usually the one that is geographically close to the source of the request). Within the distributed storage system 100, the server identifies one or more storage devices 105 that have the requested data and returns the requested data to the requesting client. Note that the client-requested data may be stored in the data storage devices at the same data center as the server or in the data storage devices at another data center remote from the server. A data update request (e.g., adding a video stream file to the distributed storage system or deleting a video stream file from the distributed storage system) submitted to the distributed storage system 100 may cause delete operations at one or more storage devices that store the video stream file.
In some implementations, data within a storage device 105 is organized into tablets to combine the benefit of a file system and that of a database system. For example, the storage device 105 includes a table-like data structure including multiple rows, each row including data associated with a user account of an on-line service and one or more pointers or references to files managed by a file system associated with the storage device 105. A tablet is a data unit including one or more rows (or partial rows) that associated a file in the file system with a particular entry in the tablet.
In some implementations, files associated with the tablet descriptor file 210 are divided into two groups: a group of target files such as files 240-1 and 240-2 and a group of reference files 250-1, 250-2, and 250-M. A target file corresponds to a file that has some data (e.g., an email message or a segment of a video stream) managed by a storage device in connection with an on-line service. A reference file corresponds to a file in the file system that represents a reference to a target file, which may be generated in response to a data access request from a particular client to the distributed storage system 100. Accordingly, the tablet descriptor file 210 includes a list of target file names 220 and a list of references 230. Each file name (220-1, 220-2) in the list of target file names 220 identified a target file (240-1, 240-2) in the file system. In some implementations, the file name includes a directory path to the target file in the file system.
A reference 230-1 in the list of references 230 further includes a status indicator 231-1, a target file name 233-1, and a reference file name 235-1. The status indicator may have one of multiple attributes indicating that the current status of a reference file associated with the reference. For example, the status indicator of a reference file that has been generated in the file system but whose corresponding reference is still being generated in the tablet descriptor file 210 is “TENTATIVE.” After the corresponding reference is generated in the tablet descriptor file 210, the status indicator changes from “TENTATIVE” to “LIVE,” indicating the completion of generating the reference. In response to a request for deleting the reference and before the deletion of the reference from the tablet descriptor file 210, the status indicator changes from “LIVE” to “TO-DELETE.” The target file name 233-1 identifies a target file in the file system and it is the same as the corresponding target file name 220-1 in the list of target file names 220 (as indicated by the dashed-line between the target file name 233-1 and the target file 240-1). The reference file name 235-1 identifies a reference file 250-1 in the file system. In some implementations, there is a predefined naming convention for the reference file name 235-1. As shown in
In some implementations, a reference 230-1 is generated in the list of references 230 in connection with the creation of a target file 240-1 in the file system because the creation of the target file 240-1 is usually triggered by a client access request for the data in the target file 240-1. In this case, the reference 230-1 is typically the first reference in the tablet descriptor file 210 for the target file 240-1. In addition to the reference 230-1, a reference file 250-1 is generated in the file system. In some implementations, the reference file 250-1 is an empty file because its existence is to indicate that there is at least one reference to the target file 240-1. In response to another client access request for the data in the target file 240-1, a new reference 230-M is generated in the list of references 230 and a new reference file 250-M is generated in the file system, indicating that one target file may be referenced for multiple times by different clients and is therefore associated with multiple reference files in the file system.
Of course, it is also possible that a target file 240-2 may be referenced by only one client and therefore has only one reference file 250-2. It should be noted that the reference entry 230-2 in the list of references 230 may or may not be the entry corresponding to the creation of the target file 240-2. For example, a target file may, at some point, be referenced by multiple clients and has therefore multiple references in the tablet descriptor file. But as time goes on, many references (including the one associated with the creation of the target file 240-2) may be deleted such that there is only one reference 230-2 in the list of references 230 for the target file 240-2. As will be described below, a deletion of the reference 230-2 will trigger the deletion of the target file 240-2 because it has no active reference in the tablet descriptor file 210, which indicates that the target file 240-2 and the reference file 250-2 should be cleaned up from the file system so that the file system can reclaim the space occupied by the two files for other uses.
Next, the server adds (307) the new reference R to the tablet descriptor file D(T) and creates an empty reference file in the file system using the reference file name Ref_Name. The server then adds (309) the new target file name X to the list of target file names of the tablet descriptor file D(T) and creates the target file X in the file system. After the creation of the target file X and the reference file Ref_Name in the file system, the server updates (311) the reference R to change its status indicator from “TENTATIVE” to “LIVE.” In some implementations, the status indicator of the reference R serves like a lock to the reference R in the tablet descriptor file D(T) to deny a client request for a target file through a particular reference R if the reference's status indicator is not “LIVE.”
Next, the server checks (349) whether there is any other existing reference to the target file X. In some implementations, the server performs this operation by checking whether there is any reference file in the file system including the file name of the target file X. If so (349-Yes), the server stops taking further actions. Otherwise (349-No), the server determines that all the references to the target file X have been deleted, which renders the target file X obsolete. As such, the removal of the target file X from the file system is assumed to have no impact on the performance of the distributed storage system 100. Accordingly, the server deletes (351) the target file X from the file system. The server also deletes (353) the file name “X” and all the references to the file name “X” (whose status indicators are presumably “TO-DELETE”) from the tablet descriptor file D(T).
Reference has been made in detail to implementations, examples of which are illustrated in the accompanying drawings. While particular implementations are described, it will be understood it is not intended to limit the invention to these particular implementations. On the contrary, the invention includes alternatives, modifications and equivalents that are within the spirit and scope of the appended claims. Numerous specific details are set forth in order to provide a thorough understanding of the subject matter presented herein. But it will be apparent to one of ordinary skill in the art that the subject matter may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to unnecessarily obscure aspects of the implementations.
Although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, first ranking criteria could be termed second ranking criteria, and, similarly, second ranking criteria could be termed first ranking criteria, without departing from the scope of the present invention. First ranking criteria and second ranking criteria are both ranking criteria, but they are not the same ranking criteria.
The terminology used in the description of the invention herein is for the purpose of describing particular implementations only and is not intended to be limiting of the invention. As used in the description of the invention and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term “and/or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. It will be further understood that the terms “includes,” “including,” “comprises,” and/or “comprising,” when used in this specification, specify the presence of stated features, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, operations, elements, components, and/or groups thereof.
As used herein, the term “if” may be construed to mean “when” or “upon” or “in response to determining” or “in accordance with a determination” or “in response to detecting,” that a stated condition precedent is true, depending on the context. Similarly, the phrase “if it is determined [that a stated condition precedent is true]” or “if [a stated condition precedent is true]” or “when [a stated condition precedent is true]” may be construed to mean “upon determining” or “in response to determining” or “in accordance with a determination” or “upon detecting” or “in response to detecting” that the stated condition precedent is true, depending on the context.
Although some of the various drawings illustrate a number of logical stages in a particular order, stages that are not order dependent may be reordered and other stages may be combined or broken out. While some reordering or other groupings are specifically mentioned, others will be obvious to those of ordinary skill in the art and so do not present an exhaustive list of alternatives. For example, it is possible for the set top box to send raw audio signal to the TV content recognition server, which is then responsible for converting the audio signal into audio fingerprints. Moreover, it should be recognized that the stages could be implemented in hardware, firmware, software or any combination thereof.
The foregoing description, for purpose of explanation, has been described with reference to specific implementations. However, the illustrative discussions above are not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The implementations were chosen and described in order to best explain principles of the invention and its practical applications, to thereby enable others skilled in the art to best utilize the invention and various implementations with various modifications as are suited to the particular use contemplated. Implementations include alternatives, modifications and equivalents that are within the spirit and scope of the appended claims. Numerous specific details are set forth in order to provide a thorough understanding of the subject matter presented herein. But it will be apparent to one of ordinary skill in the art that the subject matter may be practiced without these specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to unnecessarily obscure aspects of the implementations.
This application is a continuation of U.S. application Ser. No. 13/909,021, filed Jun. 3, 2013, entitled “Method and System for Deleting Obsolete Files from a File System,” which claims priority to U.S. Provisional Application No. 61/655,452, filed Jun. 4, 2012, entitled “Method and System for Deleting Obsolete Files from a File System,” both of which are incorporated by reference herein in their entirety. This application is related to U.S. application Ser. No. 13/898,411, filed May 20, 2013, entitled “Organizing Data in a Distributed Storage System,” which is incorporated by reference herein in its entirety.
Number | Name | Date | Kind |
---|---|---|---|
5333315 | Saether et al. | Jul 1994 | A |
5421007 | Coleman et al. | May 1995 | A |
5832521 | Klots et al. | Nov 1998 | A |
6477544 | Bolosky et al. | Nov 2002 | B1 |
6772155 | Stegelmann | Aug 2004 | B1 |
6963914 | Breitbart et al. | Nov 2005 | B1 |
6981114 | Wu et al. | Dec 2005 | B1 |
7065618 | Ghemawat et al. | Jun 2006 | B1 |
7334004 | Ganesh et al. | Feb 2008 | B2 |
7363326 | Margolus | Apr 2008 | B2 |
7430570 | Srinivasan et al. | Sep 2008 | B1 |
7567973 | Burrows et al. | Jul 2009 | B1 |
7774469 | Massa et al. | Aug 2010 | B2 |
8627135 | Aron et al. | Jan 2014 | B2 |
8850130 | Aron et al. | Jan 2014 | B1 |
8719432 | Vermeulen et al. | May 2014 | B1 |
8806323 | Samavedula | Aug 2014 | B2 |
8838539 | Ashcraft et al. | Sep 2014 | B1 |
8949208 | Xu et al. | Feb 2015 | B1 |
9678968 | Taylor | Jun 2017 | B1 |
20020133507 | Holenstein et al. | Sep 2002 | A1 |
20020178249 | Prabakaran et al. | Nov 2002 | A1 |
20030065708 | Jacobs et al. | Apr 2003 | A1 |
20030132855 | Swan | Jul 2003 | A1 |
20050015404 | Cherkasova | Jan 2005 | A1 |
20050066118 | Perry | Mar 2005 | A1 |
20050149627 | Schreter | Jul 2005 | A1 |
20050177590 | Chen et al. | Aug 2005 | A1 |
20050192991 | Nomoto | Sep 2005 | A1 |
20050210218 | Hoogterp | Sep 2005 | A1 |
20060047895 | Rowan | Mar 2006 | A1 |
20070016546 | De Vorchik | Jan 2007 | A1 |
20070050429 | Goldring et al. | Mar 2007 | A1 |
20070183224 | Erofeev | Aug 2007 | A1 |
20080071853 | Mosler et al. | Mar 2008 | A1 |
20080096662 | Kuwahara et al. | Apr 2008 | A1 |
20080133616 | Willoughby | Jun 2008 | A1 |
20080201366 | Devarakonda et al. | Aug 2008 | A1 |
20080243879 | Gokhale et al. | Oct 2008 | A1 |
20080250072 | Nguyen | Oct 2008 | A1 |
20080263305 | Shu | Oct 2008 | A1 |
20090070330 | Hwang et al. | Mar 2009 | A1 |
20090327642 | Ogihara et al. | Dec 2009 | A1 |
20100023520 | Barboy et al. | Jan 2010 | A1 |
20100077165 | Lu et al. | Mar 2010 | A1 |
20100281013 | Graefe | Nov 2010 | A1 |
20110196664 | Zunger et al. | Aug 2011 | A1 |
20120036161 | Lacapra | Feb 2012 | A1 |
20120151272 | Behrendt et al. | Jun 2012 | A1 |
20120159102 | Kan | Jun 2012 | A1 |
20120303791 | Calder et al. | Nov 2012 | A1 |
20130060742 | Chang et al. | Mar 2013 | A1 |
20130110774 | Shah et al. | May 2013 | A1 |
20130204991 | Skjolsvold et al. | Aug 2013 | A1 |
20130318129 | Vingralek et al. | Nov 2013 | A1 |
20130346365 | Kan et al. | Dec 2013 | A1 |
20140007239 | Sharpe | Jan 2014 | A1 |
20150012497 | Clark et al. | Jan 2015 | A1 |
Number | Date | Country |
---|---|---|
101001148 | Jul 2007 | CN |
101316274 | Dec 2008 | CN |
101854392 | Oct 2010 | CN |
WO 2011100366 | Aug 2011 | WO |
WO 2012040391 | Mar 2012 | WO |
Entry |
---|
Ferro, A Critique of Snapshot Isolation, Yahoo Research, Apr. 10-13, 2012, 14 pgs. |
Thomson, Calvin: Fast Distributed Transactions for Partitioned Database Systems, May 20-24, 2012, 12 pgs. |
Cahill, Seriallizable Isolation for Snapshot Databases, Jun. 9-12, 2008, 10 pgs. |
Bernstein, Chapter 5—Multiversion Concurrency Control, Concurrency Control and Recovery in Database Systems, Jan. 1, 1987, 24 pgs. |
Chang, Bigtable: A Distributed Storage System for Structured Data, Google, Nov. 2006, 14 pgs, research.google.com/archive/bigtable.html. |
Elmasri, Chapter 20—Physical Database Design and Tuning, Fundamentals of Database Systems, 6th Ed., Addison-Wesley, Jan. 1, 2011, 16 pgs. |
Garcia-Molina, Chapter 18—Concurrency Control, Database Systems: The Complete Book, Prentice-Hall, Jan. 1, 2002, 72 pgs. |
Garcia-Molina, Chapter 1—The Worlds of Database Systems, Database Systems: The Complete Book, Prentice Hall, Jan. 1, 2002, 21 pgs. |
Ghemawat, The Google File System, Proc. of the ACM Symposium on Operating Systems Principles, Oct. 19, 2003, pp. 1-15. |
Google Inc., International Preliminary Report on Patentability, PCT/US2013/044105, dated Dec. 9, 2014, 4 pgs. |
Google Inc., International Preliminary Report on Patentability, PCT/US2013/044163, dated Dec. 9, 2014, 9 pgs. |
Google Inc., International Search Report and Written Opinion, PCT/US2013/042063, dated Dec. 13, 2013, 16 pgs. |
Google Inc., International Search Report and Written Opinion, PCT/US2013/044105, dated Nov. 14, 2013, 6 pgs. |
Google Inc., International Search Report and Written Opinion, PCT/US2013/044163, dated May 9, 2014, 11 pgs. |
Google Inc., Invitation to Pay Additional Fees, PCT/US2013/042063, dated Jul. 30, 2013, 8 pgs. |
Ivanova, Self-Organizing Strategies for a Column-Store Database, Proc. 11th Int'l Conf. on Extending Database Technology Advances in Database Technology, EDBT'08, Mar. 25, 2008, pp. 157-168. |
Zhang, Supporting Multi-Row Distributed Transactions with Global Snapshot Isolation Using Bare-Bones Hbase, 11th IEEE/ACM Int'l Conf. on Grid Computing, Piscataway, NJ, Oct. 25, 2010, pp. 177-184. |
Notification of First Office Action CN 201380037792.3, dated Sep. 28, 2016, 11 pgs. |
Number | Date | Country | |
---|---|---|---|
20170011056 A1 | Jan 2017 | US |
Number | Date | Country | |
---|---|---|---|
61655452 | Jun 2012 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 13909021 | Jun 2013 | US |
Child | 15269788 | US |