On Tue, 20 Mar 2001, Perrin Harkins wrote:

> Stas Bekman wrote:
> > So basically what you are saying is that sync() is broken and shouldn't be
> > used at all. Something fishy is going on. The purpose of sync() is to
> > flush the modifications to the disk.
>
> Saving changes to disk isn't the problem.  The issue is that some of the
> database gets cached in memory when you open the database (even if you
> don't actually read anything from it), so changes made in other
> processes will not be seen.  To get around this, you would have to
> somehow reload the cached data from disk just after getting a write lock
> but before making any changes.
>
> > Unless you are talking about a process that wants to read after some other
> > process had changed the database, and there is a hazard that the former
> > process has the data cached and will not know that dbm has been modified.
>
> Exactly.  Keeping the database open is fine as long as you have a
> read-only app.  For read/write, you have to tie/untie every time.  Or
> use BerkeleyDB.

Ok, what about calling sync before accesing the database? (read and write)
Will it force the process to sync its data with the disk, or will it cause
the corruption of the file on the disk, as the process might have a stale
data?

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Reply via email to