|
Recovery and filesystem operationsThe Berkeley DB API supports creating, removing and renaming files. Creating files is supported by the DB->open method. Removing files is supported by the DB_ENV->dbremove and DB->remove methods. Renaming files is supported by the DB_ENV->dbrename and DB->rename methods. (There are two methods for removing and renaming files because one of the methods is transactionally protected and one is not.) Berkeley DB does not permit specifying the DB_TRUNCATE flag when opening a file in a transaction-protected environment. This is an implicit file deletion, but one that does not always require the same operating system file permissions as deleting and creating a file do. If you have changed the name of a file or deleted it outside of the Berkeley DB library (for example, you explicitly removed a file using your normal operating system utilities), then it is possible that recovery will not be able to find a database to which the log refers. In this case, db_recover will produce a warning message, saying it was unable to locate a file it expected to find. This message is only a warning because the file may have been subsequently deleted as part of normal database operations before the failure occurred, so is not necessarily a problem. Generally, any filesystem operations that are performed outside the Berkeley DB interface should be performed at the same time as making a snapshot of the database. To perform filesystem operations correctly, do the following:
|