How to recover from this permanent fatal error?

Felipe Contreras felipe.contreras at gmail.com
Sat Jun 5 15:39:28 BST 2021


On Fri, Jun 4, 2021 at 9:43 PM Olly Betts <olly at survex.com> wrote:
>
> On Fri, Jun 04, 2021 at 08:40:56PM -0500, Felipe Contreras wrote:
> > On Fri, Jun 4, 2021 at 8:37 PM David Bremner <david at tethera.net> wrote:
> > > Felipe Contreras <felipe.contreras at gmail.com> writes:
> >
> > > > I can't use notmuch anymore, I get this error:
> > > >
> > > > A Xapian exception occurred opening database: The revision being read
> > > > has been discarded - you should call Xapian::Database::reopen() and
> > > > retry the operation
> > > >
> > > > Context. In order to investigate a bug about mbsync I moved away the
> > > > folder ~/mail/.notmuch. I have a timer that calls notmuch new after
> > > > mbsync, so I paused that timer.
> > > >
> > > > Initially I used notmuch, only to see everything empty. Then I
> > > > recalled what I did, removed all the files, and moved back the .nomuch
> > > > directory.
>
> Perhaps a process had the database or the empty replacement open for
> writing over the moving aside or the moving back?  That could result
> in a broken database.

Perhaps.

> > `xapian-check ~/mail/.notmuch/xapian F` doesn't seem to change anything.

> In newer format databases (glass) we eliminated these files and
> currently the "fix" mode doesn't actually do anything for glass.
>
> The plan was to teach xapian-check how to recreate the `iamglass` file,
> but that doesn't seem to suffer from the truncation problem and so it
> hasn't actually been implemented yet and so "F" currently does nothing
> for glass databases.

Well, my databases seem to be glass.

> > > > IIRC I was able to use notmuch without problems once, and then I got the issue.
> > >
> > > Maybe the Xapian folk will have a more concrete suggestion, but I would
> > > start by running xapian-check on the database. In your case I guess that
> > > should be "xapian-check ~/mail/.notmuch".
>
> I'd suggest trying this simple tool I wrote that can probably rescue the
> tags from a broken notmuch database (the tags are the part notmuch can't
> just recreate by reindexing):
>
> https://git.xapian.org/?p=xapian;a=blob;f=README.notmuch;hb=refs/heads/notmuch-tag-rescue-hack

I can't seem to build it:

In file included from matcher/valuestreamdocument.h:24,
                 from matcher/postlisttree.h:26,
                 from matcher/andmaybepostlist.h:24,
                 from matcher/andmaybepostlist.cc:23:
./backends/documentinternal.h: In member function
‘Xapian::Document::Internal::remove_posting_result
Xapian::Document::Internal::remove_postings(const string&,
Xapian::termpos, Xapian::termpos, Xapian::termcount,
Xapian::termpos&)’:
./backends/documentinternal.h:339:29: error: ‘numeric_limits’ was not
declared in this scope
  339 |                 wdf_delta = numeric_limits<Xapian::termcount>::max();
      |                             ^~~~~~~~~~~~~~

I think I can live starting from scratch again. However, I thought
perhaps there was an easy fix.

Cheers.

-- 
Felipe Contreras



More information about the Xapian-discuss mailing list