[Xapian-discuss] Atomic DB rebuilds

Olly Betts olly at survex.com
Wed Oct 13 15:07:01 BST 2004


On Wed, Oct 06, 2004 at 01:11:31PM +0100, Sam Liddicott wrote:
> I'm not complaining, but I think the conclusion is that there is 
> currently no way to atomically replace a xapian database that is in 
> production use.

James' suggestion of using a stub database will do the trick, other than
that you ought to wait for a short time after switching before deleting
the old database to allow for a reader which is still in the process of
opening it - once all the tables are open, you can safely delete them
(on Unix at least).

It'd be better if this could be done more neatly, but at present I don't
think that's possible.  I do have a plan to allow readers to lock
revisions they're using (so no more DatabaseModifiedError!), and that
would enable use to easily know when the old database is no longer in
use.  But this reader locking is part of a reworking of the Btree
revisioning scheme, so it's a hefty change.

Cheers,
    Olly



More information about the Xapian-discuss mailing list