chtaylo3 <[EMAIL PROTECTED]> wrote:
> Jay,
> 
> >It's important that the journal file be preserved between reboots.
> >If the power fails you can then recover the database using the journal.
> >If your code has to go on one of the linuxes(linuxii??)
> >that follow posix/LSG standards you'll want to know how to make
> >it work correctly on those machines.
> 
> That makes perfect sence.  So you'd want sqlite to use /var/tmp.
> 
> The question still remains why one needs to read the contents of the dir.  
> Why 
> not just try to create (as opposed to open) a file using fopen and then if it 
> fails because the file already exists, just increment the filename until you 
> get a filename that's not in use?
> 

SQLite opens the directory so that it can fsync() it.  It
wants to fsync() the directory after creating the journal file
to make sure that the inode for the journal file gets created
and updated properly.  

Some unix filesystems guarantee that inodes always get updated
correctly.  Others do not.  If the inodes are not updated 
correctly and you take a power failure, the journal file name
might not appear in the /tmp folder, and unfinished changes
might therefore not get rolled back.
--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to