Re: Xapian 1.4.5 "Db block overwritten - are there multiple writers?" with Glass

Olly Betts <[email protected]>
Newsgroups gmane.comp.search.xapian.general
Message-ID <[email protected]>
On Wed, Mar 07, 2018 at 08:16:23PM +0000, Olly Betts wrote:
> Just to update the status of this - I now have a C++ reproducer, and
> have found that the transaction isn't needed to reproduce this.  It
> also still reproduces when run under eatmydata [1], and together these
> bring the time to reproduce down to 4-5 minutes.  Still longer than
> ideal, but quick enough to start making some progress on narrowing
> down what's happening.

I was intending to finish analysing this and address it for 1.4.6, but
once I found the MSet::snippet() bug I wanted to get a fix for that out
promptly.

But I've dug into this some more now.  It's a cursor on the postlist
table which is used to look up document values which causes the problem.

The attached patch reset this cursor each time commit() is called, and
that fixes my C++ reproducer, though I think this ought to work as-is
and the real bug is at a lower level.  But if you're suffering with this
bug, the patch will probably help and there's not much scope for it
making things worse (this cursor member is lazily created, so if it's
NULL when needed a new cursor is created).

Cheers,
    Olly
glass-value-cursor-reset.patch (text/x-diff, 363 B)
diff --git a/xapian-core/backends/glass/glass_values.cc b/xapian-core/backends/glass/glass_values.cc
index ff4229be60cc..961730a0c8a7 100644
--- a/xapian-core/backends/glass/glass_values.cc
+++ b/xapian-core/backends/glass/glass_values.cc
@@ -352,6 +352,7 @@ GlassValueManager::merge_changes()
 	}
 	changes.clear();
     }
+    cursor.reset(nullptr);
 }
 
 void
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.