[Xapian-discuss] Fwd: inmemory throwing DatabaseModifiedError
Olly Betts
olly at survex.com
Tue Feb 11 21:01:28 GMT 2014
On Tue, Feb 11, 2014 at 08:12:25AM +0000, Andrew Betts wrote:
> I have a weird situation with an inmemory database, which appears to be
> throwing a DatabaseModifiedError. I had a look at the Xapian test code and
> found a comment that said:
>
> // Inmemory never throws DatabaseModifiedError
That should be correct.
> But my code (PHP bindings):
>
> $xapian_database = Xapian\Xapian::inmemory_open();
The PHP bindings aren't currently in a namespace, so it looks like
you're not using the code as we ship it, which makes it harder to say
what might be causing this.
> $xapian_database->add_document($xdoc);
> $xapian_database->commit();
>
> Is throwing:
>
> DatabaseModifiedError: The revision being read has been discarded - you
> should call Xapian::Database::reopen() and retry the operation
In the code as shipped, that error message is only in the disk-based
backends (this is for 1.2 branch; trunk is much the same though):
$ git grep 'revision being read'
backends/brass/brass_table.cc: throw Xapian::DatabaseModifiedError("The revision being read has been discarded - you should call Xapian::Database::reopen() and retry the operation");
backends/chert/chert_table.cc: throw Xapian::DatabaseModifiedError("The revision being read has been discarded - you should call Xapian::Database::reopen() and retry the operation");
backends/flint/flint_table.cc: throw Xapian::DatabaseModifiedError("The revision being read has been discarded - you should call Xapian::Database::reopen() and retry the operation");
So I'd guess that $xapian_database isn't actually an inmemory database.
> Any idea why this error would be thrown by an inmemory database? As I
> understand it, there should be no reason why this database is subject to
> interference outside of the process that creates it. In practice, these
> errors are occurring when we have a large number of inmemory databases
> being created and destroyed at the same time, so is there any way they
> could be clashing?
They shouldn't be able to clash.
Cheers,
Olly
More information about the Xapian-discuss
mailing list