On Sat, 16 Jun 2001 15:12:16 +0100, Philip Hazel wrote:
> The question is: is it actually worth the effort? I don't know. What's
> the view on the list? It's a small, but non-zero possibility, I suppose.
> I think most sites with large alias files use cdb or at least some
> variety of DB rather then the .dir/.pag libraries.
What the effort is worth depends on what the lookup is used for. :-)
However, there are two issues here, only one of which relates to the
kind of DBM (e.g. GDBM, Berkely DB, CDB). The issue that you can't get
around regardless of your implementation is the window during which the
file is updated. Since there's no POSIX "forced link" [1], you can't
guarantee atomic updates without some "hitching post" or lock.
If someone found a lookup that was so important as to make the update of
its backing DBM so crucial that this window of opportunity couldn't be
risked, I'd advise a hitching post approach instead of a lock, to ensure
portability to systems using NFS without an rcp.lockd.
Ciao,
Sheldon.
[1] Naive users are fooled into believing that a file update may be made
atomic using ln -f, but this is actually an unlink() + link()
operation, at least in BSD UNIX.