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.

- Perrin

Reply via email to