On 2 Jun 2011, at 12:45pm, Jo Blogs wrote: > Is there some way to check, using code, if a journal is hot? I'd like to be > able to do this so I can automatically remove non-hot journals. > Is there an SQLite api for opening/reading journals etc.? I've looked at the > source and all the journal related stuff seems to be private.
If the database has no active users, it should not have a journal file. In other words, if you have no active connections to a database file, there should be no journal files on disk. Consequently, the way to remove all journal files is to use the SQLite library calls to open the database file then close it again. The _open() will cause SQLite to notice the journal and do whatever's necessary to resolve the crash. The _close() will cause SQLite to delete the journal file. > I'm in a situation where my db is locking (write only) in some rare > circumstances (I believe after some sort of crash while writing to the db, > but I'm not sure). > Others have told me it has also happened to them (on ext3 aswell as nfs). > I was able to reproduce it once, but on an NFS partition. However I'm not > entirely sure how, as far as I remember I ran a load of processes writing to > the db, 50 or so on both cores, and killed them all with a killall command. > Afterwards the db was write locked, and I had a journal file of size 512kb. > However, I am able to read from it. Sorry, I have no experience with NFS. But having a closed locked journal file will certainly present a problem for SQLite. > [snip] > > Sometimes I also get a situation after a crash where the db is locked for > both read and write, in this case I get a journal file with no permissions > set of size 0kb. I think you need an NFS expert but a journal file of size 0kb does suggest a problem with your file system os ? hardware ?) rather than a problem with SQLite. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

