[Xapian-discuss] Threaded test (in C++) to reproduce our database problems

James Aylett james-xapian@tartarus.org
Thu, 17 Jun 2004 10:39:53 +0100


On Thu, Jun 17, 2004 at 12:30:50AM -0400, Eric B. Ridge wrote:

> I've hacked up the C++ thread test to do this:
> 
> - 2 Writer threads.  Each to a *different* database
> - ZERO! reader threads.
> 
> In theory, these guys should not interfere with each other, right?  Or am I
> clueless here too?
> 
> Check this out:
> 
> ----------------------------
> $ rm -rf /tmp/*.db && build/xapian_threads
> Opening /tmp/one.db
> Opening /tmp/two.db
> Writer /tmp/one.db: flush()
> Writer /tmp/two.db: flush()
> <repeats a bunch of times>
> Writer /tmp/one.db: flush()
> Writer /tmp/two.db: flush()
> Writer /tmp/one.db: flush()
> Writer /tmp/two.db: ERROR=Db block overwritten
> Writer /tmp/two.db thread unexpectedly exited...
> Writer /tmp/one.db: ERROR=Error reading block 44: got end of file
> Writer /tmp/one.db thread unexpectedly exited...
> -----------------------------
> 
> Explain this one.  ;)  Now I'm really stumped.  Can't write to two separate
> databases at a time?  Hmm...

I've got this running happily here on fairly recent CVS code. What
OS/processor are you using? What compiler? (That code won't compile
straight off with g++ 3.0 on Deibha/ia32 because the type of the
pthread target function is wrong; I fixed the code to compile and am
not seeing the issue.)

J

-- 
/--------------------------------------------------------------------------\
  James Aylett                                                  xapian.org
  james@tartarus.org                               uncertaintydivision.org