[Xapian-discuss] Flint Database 'Can't acquire write lock'?

Olly Betts olly at survex.com
Fri Apr 20 16:45:22 BST 2007


On Fri, Apr 20, 2007 at 02:09:43PM +0100, Richard Boulton wrote:
> Having taken a quick peek at the code, there are quite a few different 
> ways it can fail - it would be nice to report which of these happened to 
> the user, somehow (presumably in the form of different messages in the 
> exception raised).  This would require the Lock object to return that 
> information to the place that the exception is raised (or to move the 
> raising of the exception into the Lock object).

The main problem is that the interesting errors will happen in the child
process (in particular, that's where fcntl() is called), so you need a
mechanism for communicating them to the parent.

Some errors aren't sensible to try to communicate - e.g. if "write()"
on the fd for the parent process fails, there's really is no better way
to inform the parent other than just calling exit() - the most likely
scenario at this point is that the parent has already died anyhow.

Really there are only 3 ways locking can fail - either the database is
already locked, or locking isn't supported, or we ran out of resources.

You can't actually tell for sure if locking isn't supported since the
error code from fcntl() for that case covers other situations too:

    ENOLCK Too many segment locks open, lock table is full, or a
    remote locking protocol failed (e.g. locking over NFS).

Cheers,
    Olly



More information about the Xapian-discuss mailing list