![]() ![]() Is that reproducible?īy the way, the presence of a -journal file doesn't necessarily mean that there was a crash or that there are changes to be rolled back. I can't explain why deleting a -journal file would let you lock a database that you couldn't before. Note that the sqlite FAQ recommends caution regarding concurrent access to databases on NFS volumes, because of buggy implementations of NFS file locking. In that case, a workaround is to replace the database file with a fresh copy that isn't locked on the NFS server (mv database.db original.db cp original.db database.db). Another possibility is a stale NFS lock, if the database is on an NFS volume. As others have said, one possible reason for this is that another process currently has it open. The rollback is supposed to happen automatically the next time the database is opened, but it will fail if the process can't lock the database. We know of no way to prevent this other than user education. The user then deletes the hot journal, thinking that they are helping to cleanup the system. But after the crash, there is also a hot journal named "important.data-journal". They see their database file named "important.data". After power is restored, a well-meaning user or system administrator begins looking around on the disk for damage. We suspect that a common failure mode for SQLite recovery happens like this: A power failure occurs. If a crash or power loss does occur and a hot journal is left on the disk, it is essential that the original database file and the hot journal remain on disk with their original names until the database file is opened by another SQLite process and rolled back. If you delete it while the database is in an inconsistent state, then you're left with a corrupted database. It's there to allow sqlite to roll back the database to a consistent state after a crash. Deleting the -journal file sounds like a terrible idea.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |