On Fri, 17 May 2002, Richard Gilbert wrote:
> Thank you for your prompt reply, as ever. However, what I meant by update
> was writing to the NDBM file directly. I was thinking of using a Perl
> script which used tie, e.g.
Exim does not lock DBM files that it uses in lookups.[*] The reasons are:
(1) It never writes to them.
(2) Different DBM libraries use different numbers of files.
(3) You can't actually just lock the files. You have to take a lock on
_another_ file before opening, because DBM libraries do things
between open() and returning to the caller. This would require Exim
being able to create such a lock file.
So using dynamic update is dangerous.
If it were possible to install a new NDBM file by renaming, I would
suggest dynamically updating a *copy* of the file, and then renaming it
into place. You could certainly do this using Berkeley DB, or any other
DBM library that uses a single file.
You can't of course do this with cdb, because it's designed not to be
updated. But building cdb files is fast.
----------------
[*] It does use locks for its hints data (using separate lock files).
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.