Andrew Betts
2014-Feb-11 08:12 UTC
[Xapian-discuss] Fwd: inmemory throwing DatabaseModifiedError
Hi, 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 But my code (PHP bindings): $xapian_database = Xapian\Xapian::inmemory_open(); $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 On the add_document line. Here's a backtrace: #0: writabledatbase_add_document() in /vendor/ftlabs/xapian-query/src/Xapian/XapianWritableDatabase.php:40 #1: add_document() in /app/classes/XapianDatabases:111 #2: filterQueriesForPost() in /app/classes/indexingjobs/XapianStreamFinder.php:38 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? 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.
Olly Betts
2014-Feb-11 21:01 UTC
[Xapian-discuss] Fwd: inmemory throwing DatabaseModifiedError
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 DatabaseModifiedErrorThat 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 operationIn 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