From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AEDEC429E5E for ; Tue, 5 Nov 2013 12:14:39 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X2BsyYwegY6N for ; Tue, 5 Nov 2013 12:14:31 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 8EC13431FDD for ; Tue, 5 Nov 2013 12:14:31 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 175FF100051; Tue, 5 Nov 2013 22:14:25 +0200 (EET) From: Tomi Ollila To: Ben Gamari , David Bremner , Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH v2 00/11] compactor changes v2 In-Reply-To: <87wqkmhcpm.fsf@gmail.com> References: <87k3gnqfb4.fsf@zancas.localnet> <87wqkmhcpm.fsf@gmail.com> User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2013 20:14:39 -0000 On Tue, Nov 05 2013, Ben Gamari wrote: > Tomi Ollila 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