This invention relates generally to databases for digital data storage and retrieval, and more particularly to the management of physical file system objects such as files and directories created or dropped on mirrored databases.
Enterprises employ database systems comprising mirrored databases as a repository of the enterprise's stored data, and such systems provide architecture to support operational systems such as online transaction processing (OLTP). The databases generally have large sizes, store large volumes of data, and experience high numbers of operations.
Mirrored databases comprise a primary database and a mirror database pair that are synchronized by redundantly writing the same data to both databases for backup and to assure high availability of the data if one of the databases fails (crashes). In the event of a crash, or loss of communications with a database, a mirror resynchronization process is performed by the system to manage the creation and deletion of file directories and file objects on both mirrors that store database data to restore the databases to a synchronized state. Mirror resynchronization will re-create file system objects that may not have been created and attempt to remove objects that were logically dropped while the mirror was down. Additionally, if a crash occurs during a transaction, physical file system objects that may have been created by aborted database transactions and those that may have been dropped by committed database transactions may remain. Mirror resynchronization needs to know which file system objects to clean up on the mirrors that were logically deleted and which file system objects to re-create that were logically created while the mirror was down. Frequently, this information is not readily available.
The file systems used in databases typically do not support external local or distributed transactions, and have no mechanism for accurately and durably recording which file system objects are in use by the database. Moreover, some database systems do have a crash recovery undo so that there is no mechanism to remove physical objects by an aborted transaction during crash recovery. They can only do redo operations during crash recovery by replaying and redoing all work recorded in a transaction log, such as a Write Ahead Log (WAL), since a last database checkpoint. For large databases, this can be a very lengthy process. The database systems generally lose track of file directories and files used by the database when the database crashes, and physical files would be left around with old database data and would occupy disk space without the knowledge of the database, which can hamper performance. With mirrored databases, this situation is exacerbated.
It is desirable to provide systems and methods that address this and other problems of resynchronization of mirrored databases following a database crash by facilitating cleanup of physical file system objects from the databases, and it is to these ends that the present invention is directed.
The invention is particularly well adapted for use with database systems that employ mirrored database pairs comprising a primary database and a mirror database which store the same data, and will be described in that context. As will be appreciated, however, this is illustrative of only one utility of the invention, and the invention may also be used, for example, to manage a non-mirrored database.
The invention addresses the problems of managing database physical file directories and file system objects in conjunction with database transactions, crash recovery, and mirror resynchronization by employing a careful-write of intentions process in connection with database transactions to durably and accurately record persistent file system object records to facilitate and manage the creation and deletion of file directories and files on a database. As will be described in more detail, the invention in one embodiment utilizes a persistent file system objects table in which records of intentions to perform file system actions are first written, and the table is flushed to disk before an action is taken. The table may be used to track whether a file system object was or might have been created. If a crash occurs, the crash recovery process may examine the intention records in the table and perform either clean up (delete) or retry of the action depending upon whether the transaction aborted or committed. Similarly, mirror resynchronization may use the intention records to facilitate resynchronization of a mirror database. In one embodiment, there are two intentions to perform file system actions for which such record are maintained. These are create and delete. A create intention remembers a file system object which may have been created during a user transaction that might abort and which will need to be deleted later. A delete intention remembers that a file system object was logically deleted by a transaction and that file system object needs to be reliably and physically removed after the transaction commits.
If the database crashes during a transaction abort, the previously recorded intention record in the persistent file system objects table insures that crash recovery will remove the file system object that was physically created by the aborted transaction.
Similarly, if a user wishes to delete a file system object that was created in an earlier transaction, the user cannot physically delete the file system object during an active phase of the transaction because the transaction might abort. Also, standard transaction protocols are such that aborted transactions do not affect data. Thus, deletion of the physical file system object must be postponed until post-commit time, at which time the persistent file system objects table record will be updated to “Drop Pending” to durably remember that the file system object needs to be physically removed.
Persistent file system table data is system data that is changed outside of the scope of an actual transaction so that it may be used by the database during post transaction processing to clean up file system objects. If a database crashes, crash recovery can use the information in the persistent file system object able to retry clean up. Record changes are like small buffered writes. If the transaction log (e.g., the Write Ahead Log) with a record change is flushed to disk, the change is durable and will be seen by crash recovery if the database crashes after the flush. Similarly, inserting an intention records into the file system objects table and flushing the transaction log to disk amounts to a durable careful write that preserves the persistent object records for later use.
For a mirror database, additional persistent state records in the persistent file system objects table track whether a file system object has been or might have been created on the mirror. Mirror resynchronize will re-create file system objects that might not have been created on the mirror. If a database object was logically dropped while the mirror was down, a as going down, then mirror resynchronize will find the persistent entry in the persistent file system objects table marked “Only Mirror Drop Remains” that indicates that the file system object must be removed from the mirror.
As may be appreciated from the foregoing, the invention affords accurate ownership of all physical file directories and physical files in a database system that are used to store database data, so that there are no lost or extra file directories and no lost or extra files in the databases. No lost file directories and no lost files means no lost disk space by the database. No extra file directories and no extra files is a major benefit because mirror database verification can quickly and easily identify the file directories and files to compare during crash recovery and mirror resynchronize, and readily determine whether the primary and mirrored databases are synchronized. Furthermore, by providing a durable and accurate careful write of intentions to perform file system actions, the invention dramatically improves the performance of mirrored databases, and dramatically reduces crash recovery times in the event of a failure and the time to resynchronize mirrored databases.
An embodiment of the invention affords a computer storage product comprising a computer readable storage medium storing executable computer instructions for controlling the operations of computer systems to perform the processing operations described herein. The computer readable medium may be any standard media well known and available to those skilled in the art, including, but not limited to magnetic media such as hard disks, floppy disks, magnetic tape; optical media such as CD-ROMs, DVDs, holographic devices; magneto-optical media; and hardware devices configured to store and execute program code, such as application-specific integrated circuits (ASICs), programmable logic devices and ROM and RAM devices.
While the foregoing description has been with reference to particular embodiments of the invention, it will be appreciated by those skilled in the art that modifications to these embodiments may be made without departing from the principles and spirit the invention, the scope of which is defined by the appended claims.
This application is a division of U.S. patent application Ser. No. 14/194,342, filed on Feb. 28, 2014, entitled “PERSISTENT FILE SYSTEM OBJECTS FOR MANAGEMENT OF DATABASES”, issued on May 24, 2016 as U.S. Pat. No. 9,348,831, which is a continuation of U.S. patent application Ser. No. 13/107,898, filed on May 14, 2011, entitled “PERSISTENT FILE SYSTEM OBJECTS FOR MANAGEMENT OF DATABASES”, issued on Mar. 4, 2014 as U.S. Pat. No. 8,667,033. The entire contents of the foregoing applications are hereby incorporated by reference.
Number | Name | Date | Kind |
---|---|---|---|
6259444 | Palmer et al. | Jul 2001 | B1 |
7225204 | Manley et al. | May 2007 | B2 |
7512755 | Iwamura et al. | Mar 2009 | B2 |
8667033 | McCline et al. | Mar 2014 | B1 |
20010007108 | Teich et al. | Jul 2001 | A1 |
20040158588 | Pruet | Aug 2004 | A1 |
20040205152 | Yasuda | Oct 2004 | A1 |
20040216109 | Bhogi | Oct 2004 | A1 |
20040267835 | Zwilling et al. | Dec 2004 | A1 |
20060235909 | Oks | Oct 2006 | A1 |
20070112884 | Perrin et al. | May 2007 | A1 |
20080163175 | Krauss | Jul 2008 | A1 |
20100250719 | Klug | Sep 2010 | A1 |
20100257198 | Cohen et al. | Oct 2010 | A1 |
20100293222 | Pope et al. | Nov 2010 | A1 |
20110145201 | Holst et al. | Jun 2011 | A1 |
Number | Date | Country | |
---|---|---|---|
Parent | 14194342 | Feb 2014 | US |
Child | 15162388 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 13107898 | May 2011 | US |
Child | 14194342 | US |