[PATCH] dump: make dump take Xapian write lock

Mark Walters markwalters1009 at gmail.com
Tue Jul 15 23:50:41 PDT 2014


On Tue, 15 Jul 2014, David Bremner <david at tethera.net> wrote:
> Mark Walters <markwalters1009 at gmail.com> writes:
>
>>
>> Discussion with Olly on irc indicates that this is currently the best
>> solution: in xapian trunk there may be better possibilities using
>> snapshots but they need to make it to a release and propogate out to
>> users before we can switch approach.
>
> I agree that this seems to be the only feasible approach to make dump
> atomic.  I'm a little unsure about the benefits to the end user though.
> Currently, the user has to check the return code of dump to ensure it
> completed correctly.  With this change, the user will still have to
> check that dump did not error out when trying to acquire a write lock.
> The following ticket
>
>       http://trac.xapian.org/ticket/275
>
> suggests that if we wanted to a blocking open, we'd be on our own.
>
> Did I miss something here about the benefits? I agree that failing
> earlier is nicer, but is that it?

You are correct that we may still fail. I think there are two
advantages in addition to failing earlier. 

First, I think that if the dump fails there will not be any output file:
I think the old version would leave a partial dump (note I haven't
checked that carefully). This makes it more likely the failing dump is
noticed.

Secondly, this version will only fail if the database is being written
to when it starts: the old version would fail if something attempted to
write to it at any point during the dump, which can be relatively
lengthy. This should at least reduce the frequency of problems.

Best wishes

Mark



More information about the notmuch mailing list