unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Ben Gamari <bgamari.foss@gmail.com>,
	David Bremner <david@tethera.net>, Jani Nikula <jani@nikula.org>,
	notmuch@notmuchmail.org
Subject: Re: [PATCH v2 00/11] compactor changes v2
Date: Tue, 05 Nov 2013 22:14:24 +0200	[thread overview]
Message-ID: <m2y552a9nj.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <87wqkmhcpm.fsf@gmail.com>

On Tue, Nov 05 2013, Ben Gamari <bgamari.foss@gmail.com> wrote:

> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
>>
>> The whole series looks OK to me. The only thing I'm, a bit worried about
>> what happens is I Ctrl-C compaction at any state. Is it possible that I
>> end up with corrupted database ? Someone may accidentally execute
>> notmuch compact -- for example by picking the command from history.
>>
> You should in principle never end up in a situation where the original
> database is corrupted. Xapian's Compactor interface reads from the
> existing database and writes out the compacted database to a new
> directory. The notmuch compact command keeps the original database in
> place until the last possible moment.
>
> When the compacted database is completely constructed it, deletes or
> moves the old database out of the way and then moves the new database
> into place. The worst thing that could happen is that you manage to
> interrupt the process between deleting the old database and moving the
> new one into place (a very small window). In this case you'd simply need
> to move the new database into place manually (although you'd need to
> figure out where the compacted database is located).

Ah true. I failed to keep the whole picture in mind. Indeed the compactor
first compacts from .notmuch/xapian to .notmuch/xapian.compact (and
finally directory renaming is done in database.cc... (and with directories
we cannot do atomic file update using link()/rename() calls). 
(If we wanted to handle this "small window" we could try use 'xapian.compact'
directory in case 'xapian' was nonexistent but... :)

That understood I'm ok with these pathes (when that oversight fixed).

>   
> Cheers,
>
> - Ben

Tomi

  reply	other threads:[~2013-11-05 20:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-03 12:24 [PATCH v2 00/11] compactor changes v2 Jani Nikula
2013-11-03 12:24 ` [PATCH v2 01/11] test: fix compact backup / restore test Jani Nikula
2013-11-03 12:24 ` [PATCH v2 02/11] lib: construct compactor within try block to catch any exceptions Jani Nikula
2013-11-03 12:24 ` [PATCH v2 03/11] lib: check talloc success in compact Jani Nikula
2013-11-06 21:56   ` David Bremner
2013-11-03 12:24 ` [PATCH v2 04/11] lib: do not leak the database in compaction Jani Nikula
2013-11-03 12:24 ` [PATCH v2 05/11] lib: add closure parameter to compact status update callback Jani Nikula
2013-11-03 12:24 ` [PATCH v2 06/11] lib: update documentation of callback functions for database_compact and database_upgrade Jani Nikula
2013-11-03 12:24 ` [PATCH v2 07/11] lib: use the compaction backup path provided by the caller Jani Nikula
2013-11-05 10:54   ` David Bremner
2013-11-05 11:15     ` Jani Nikula
2013-11-03 12:24 ` [PATCH v2 08/11] cli: return error status if compaction fails Jani Nikula
2013-11-03 12:24 ` [PATCH v2 09/11] cli: add compact --backup=DIRECTORY option, don't backup by default Jani Nikula
2013-11-07 11:07   ` David Bremner
2013-11-03 12:24 ` [PATCH v2 10/11] cli: add compact --verbose option and silence output without it Jani Nikula
2013-11-06 16:38   ` [PATCH 1/2] cli: add compact --quiet option and silence output with it Jani Nikula
2013-11-06 16:38     ` [PATCH 2/2] man: document notmuch compact --quiet and --backup=DIRECTORY options Jani Nikula
2013-11-07 13:25       ` Tomi Ollila
2013-11-07 23:30     ` [PATCH 1/2] cli: add compact --quiet option and silence output with it David Bremner
2013-11-03 12:24 ` [PATCH v2 11/11] man: document notmuch compact --verbose and --backup=DIRECTORY options Jani Nikula
2013-11-05 11:05 ` [PATCH v2 00/11] compactor changes v2 David Bremner
2013-11-05 18:50   ` Tomi Ollila
2013-11-05 19:26     ` Ben Gamari
2013-11-05 20:14       ` Tomi Ollila [this message]
2013-11-05 18:48 ` Ben Gamari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2y552a9nj.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=bgamari.foss@gmail.com \
    --cc=david@tethera.net \
    --cc=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).