[Xapian-discuss] Atomic DB rebuilds
James Aylett
james-xapian at tartarus.org
Mon Oct 4 17:29:21 BST 2004
On Mon, Oct 04, 2004 at 05:26:34PM +0100, Olly Betts wrote:
> > But if I use symlinks (and I do) in /var/lib/omega/data to point to the
> > db - well as we know, its impossible to atomically update a symlink, so
> > I can't update another DB and then symlink to it once done.
>
> Do we know that?
>
> You can certainly create a new symlink with a temporary name, then use
> rename() to replace the old symlink with the old one. And according to
> "man 2 rename":
>
> If newpath already exists it will be atomically replaced (subject to a
> few conditions - see ERRORS below), so that there is no point at which
> another process attempting to access newpath will find it missing.
>
> Nothing in the ERRORS section seems to say that symlinks aren't replaced
> atomically.
I wouldn't rely on it. I have a horrible feeling that it won't always
work under NFS ...
Didn't Richard write a psuedo symlink backend that took a single file
to configure it to point to where the actual data was? So you could
rename the _file_ over the old one, which certainly is atomic, and
will work on all NFS implementations that include lockd (at least,
AFAIK).
J
--
/--------------------------------------------------------------------------\
James Aylett xapian.org
james at tartarus.org uncertaintydivision.org
More information about the Xapian-discuss
mailing list