--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id AEDEC429E5E\r
+ for <notmuch@notmuchmail.org>; Tue, 5 Nov 2013 12:14:39 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id X2BsyYwegY6N for <notmuch@notmuchmail.org>;\r
+ Tue, 5 Nov 2013 12:14:31 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 8EC13431FDD\r
+ for <notmuch@notmuchmail.org>; Tue, 5 Nov 2013 12:14:31 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 175FF100051;\r
+ Tue, 5 Nov 2013 22:14:25 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Ben Gamari <bgamari.foss@gmail.com>, David Bremner <david@tethera.net>,\r
+ Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 00/11] compactor changes v2\r
+In-Reply-To: <87wqkmhcpm.fsf@gmail.com>\r
+References: <cover.1383481295.git.jani@nikula.org>\r
+ <87k3gnqfb4.fsf@zancas.localnet>\r
+ <m21u2ubs34.fsf@guru.guru-group.fi> <87wqkmhcpm.fsf@gmail.com>\r
+User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Tue, 05 Nov 2013 22:14:24 +0200\r
+Message-ID: <m2y552a9nj.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 05 Nov 2013 20:14:39 -0000\r
+\r
+On Tue, Nov 05 2013, Ben Gamari <bgamari.foss@gmail.com> wrote:\r
+\r
+> Tomi Ollila <tomi.ollila@iki.fi> writes:\r
+>\r
+>>\r
+>> The whole series looks OK to me. The only thing I'm, a bit worried about\r
+>> what happens is I Ctrl-C compaction at any state. Is it possible that I\r
+>> end up with corrupted database ? Someone may accidentally execute\r
+>> notmuch compact -- for example by picking the command from history.\r
+>>\r
+> You should in principle never end up in a situation where the original\r
+> database is corrupted. Xapian's Compactor interface reads from the\r
+> existing database and writes out the compacted database to a new\r
+> directory. The notmuch compact command keeps the original database in\r
+> place until the last possible moment.\r
+>\r
+> When the compacted database is completely constructed it, deletes or\r
+> moves the old database out of the way and then moves the new database\r
+> into place. The worst thing that could happen is that you manage to\r
+> interrupt the process between deleting the old database and moving the\r
+> new one into place (a very small window). In this case you'd simply need\r
+> to move the new database into place manually (although you'd need to\r
+> figure out where the compacted database is located).\r
+\r
+Ah true. I failed to keep the whole picture in mind. Indeed the compactor\r
+first compacts from .notmuch/xapian to .notmuch/xapian.compact (and\r
+finally directory renaming is done in database.cc... (and with directories\r
+we cannot do atomic file update using link()/rename() calls). \r
+(If we wanted to handle this "small window" we could try use 'xapian.compact'\r
+directory in case 'xapian' was nonexistent but... :)\r
+\r
+That understood I'm ok with these pathes (when that oversight fixed).\r
+\r
+> \r
+> Cheers,\r
+>\r
+> - Ben\r
+\r
+Tomi\r