[Xapian-discuss] Threaded test (in C++) to reproduce our database problems
Olly Betts
olly@survex.com
Thu, 17 Jun 2004 02:43:56 +0100
On Wed, Jun 16, 2004 at 09:24:50PM -0400, Eric B. Ridge wrote:
> Okay, we finally broke down and write a quickie threaded test in C++ to
> reproduce the database problems we've been having. On my dual-processor Mac
> running OS X, this test fails every time.
>
> The code is below, and should be fairly straight forward. 1 writer thread
> that constantly add's documents to a Xapian::WritableDatabase, and a bunch
> of reader threads that execute queries.
Great - this should be very helpful.
> Reader: ERROR=Error reading all bytes: Bad file descriptor (fd=7)
That's very odd. That's either a Btree base file, or the meta file.
> Reader: ERROR=Error reading block 40: Bad file descriptor (fd=5)
And a DB file this time.
> Writer: flush()
> Reader: ERROR=Db block overwritten
That's less odd. After the writer has flushed twice, readers will get
this exception - they need to call reopen() and restart the operation.
> Writer: ERROR=Db block overwritten
But the writer thread shouldn't get this unless there's another writer.
> Any ideas? We wrote this little C++ test pretty quickly (could be buggy),
> but it reproduces what we're seeing from the Java-side.
I can't see anything wrong from a quick read through. I'm right in the
middle of something right now, but I'll give this a whirl in the next
day or so.
Cheers,
Olly