[Xapian-discuss] Atomic DB rebuilds
Olly Betts
olly at survex.com
Mon Oct 4 17:26:34 BST 2004
On Mon, Oct 04, 2004 at 05:05:44PM +0100, Sam Liddicott 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.
Cheers,
Olly
More information about the Xapian-discuss
mailing list