On Wed, Jan 30, 2013 at 12:44 PM, Peter Karman <[email protected]> wrote:
> Using Lucy 0.3.2, we periodically get this error:
>
>  Couldn't get deletion lock lucy_PolyReader_do_open at
> core/Lucy/Index/PolyReader.c line 274
>
> when trying to open a PolySearcher.
>
> Under what circumstances should I expect to see such an error?

I believe you must be supplying the `manager` argument to IndexReader#open,
presumably while building up the array of Searcher objects to pass to
PolySearcher#new.  Unless the index is A) on NFS and B) being modified while
live searching is taking place, there's no reason to do that.  Just omit the
`manager` parameter and it will no longer try to acquire the deletion lock.

The deletion lock -- which is an exclusive lock so only one entity can hold it
at a time -- is only held briefly during FilePurger#purge or
PolyReader#do_open.

FilePurger needs that lock after either Indexer or BackgroundMerger has
obsoleted some segments.  FilePurger acquires the lock, figures out what files
can be deleted, zaps them and then releases the lock.  If it can't acquire the
lock, FilePurger WARNs but doesn't throw an exception and leaves the files in
place.

PolyReader#do_open only needs the deletion lock while it's opening all of its
component SegReaders for an index on NFS.  If it gets the deletion lock --
thereby blocking FilePurger -- that means that none of the files that those
SegReaders are trying to open can disappear out from under them during
initialization, and so the open() operation ought to complete without being
interrupted by a "Stale NFS file handle" exception.

Opening an IndexReader for an index on an ordinary file system mount doesn't
require obtaining the deletion lock.  (I'll hold off on explaining why
unless someone makes a request.)

The IndexReader#open call (which calls PolyReader_do_open()) could be
conflicting with either other calls to IndexReader#open or with FilePurger.
But it doesn't matter -- so long as the index isn't on NFS, just delete the
`manager` parameter and you should be fine.

Marvin Humphrey

Reply via email to