On Mon, May 04, 2009 at 12:56:13PM +0800, George Wu
wrote:> Can a Xapian instance handle read during update/index flush operation?
Yes. A reader doesn't "lock down" its current version of the
database
to ensure it remains valid indefinitely (if it did, the database could
easily become bloated with old revisions), so to be robust you should
catch any DatabaseModifiedError exception in the reader and recover by
calling reopen() on the database and retrying the failed operation.
> Also, real-time search is important in our application. In a previous
> post I learnt that there can only be one Xapian instance having a write
> access. For other read-only instance, the database have to be reopened
> before the newly inserted data is visible to read-only instances. In
> this case, how fast and how efficient is the index-reopen operation?
Yes, readers look at a consistent version of the database so need to be
told to reopen() to see the latest version.
And reopen() is designed to be efficient. If you want to know how long
it takes in microseconds, you'll have to profile it on your own
hardware. If that seem too slow, send us some profiling data:
http://trac.xapian.org/wiki/ProfilingXapian
Cheers,
Olly