Hi, Thanks for the detailed explanation. My original question was more in relation to the .db-wal file. I guess the same discussion is applicable to the db-wal file also?. In my project, in all probability one writer and multiple readers. Hence the chances of corruption is greatly reduced. One problem I have noticed is that I have to create (an empty) a file with the same name as the database file in the tmpfs for correct working .
Sent from BlackBerry® on Airtel -----Original Message----- From: Richard Hipp <d...@sqlite.org> Sender: sqlite-users-boun...@sqlite.org Date: Mon, 1 Aug 2011 07:07:52 To: General Discussion of SQLite Database<sqlite-users@sqlite.org> Reply-To: General Discussion of SQLite Database <sqlite-users@sqlite.org> Subject: Re: [sqlite] Sqlite-Wal file location On Sun, Jul 31, 2011 at 11:51 PM, Sreekumar TP <sreekumar...@gmail.com>wrote: > Hello, > > Inorder to suit the needs of my embedded device, I have changed the > location > of the .db-wal file from the location of the db file to tmpfs. Does sqlite > make assumptions(persistence etc) based on the location of the file ? > An early prototype of WAL did exactly what you describe. But we then encountered database corruption during testing when two separate processes tried to access the same database file where one of the processes was in a chroot jail and the other was not. Both processes used the same name for the -shm file, but because of the chroot jail, they in fact used two separate -shm files. Fossil uses SQLite in WAL mode and it often runs in a chroot jail, so this is not an uncommon scenario. The only way we have found to ensure that all processes use the same -shm file is to put the -shm file in the same directory as the database file. For an embedded project, you can put the -shm file wherever you want as long as all processes agree to use the same file. If you mess up, and two or more processes use different -shm files for the same database, database corruption will result. You have been warned. Note that -shm does not have to be a file. We just need an area of shared memory common to all processes accessing the database. On unix and windows, we found this most convenient to implement as a file using mmap(). But if you have some other mechanism on your embedded device that would work better, you are welcomed to use that. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users