[Xapian-discuss] DatabaseModifiedError on get_data - best practice?

Andrew Betts andrew.betts at ft.com
Fri Feb 17 12:54:36 GMT 2012


Hi,

I have previously had a problem with getting this error on a get_mset
call, and solved it by subclassing XapianEnquire with a
backoff-and-retry algorithm (as suggested by this list, many thanks!).
 However, I now get it intermittently when calling get_data on a
XapianDocument.  The same solution doesn't seem to be quite as easy in
this case, because:

1. The document is not instantiated by my code, it's returned from the
Iterator, so I can't easily subclass it without editing the bindings.

2. The document doesn't have a reference to the database, so I can't
reopen it from that scope.

So, first is it necessary to reopen the database in these situations,
or could I simply call get_data on the same document object after a
brief delay?  And second, how/where would you suggest I insert the
retry procedure?  Currently I can only see a few options, none of
which seem very good, and the first two don't solve the reopen
problem):

A) Subclass XapianDocument, and in order to make the bindings use the
subclass, also subclass the iterator, matchset and enquire.
B) Hack the bindings to insert the retry into the existing
XapianDocument::get_data method.
C) Add retry at the application level (need to add to several dozen projects!)

Any ideas much appreciated.

Cheers,

Andrew
**********************************************************************************
This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL.
Registered in England and Wales with company number 53723




More information about the Xapian-discuss mailing list