From: Tomi Ollila Date: Thu, 14 Nov 2013 22:03:26 +0000 (+0200) Subject: [PATCH v3 4/5] compact: unconditionally remove old wip database compact directory X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1d2a4b8020d65753e3c9ed4ec7110e2b1c6234a6;p=notmuch-archives.git [PATCH v3 4/5] compact: unconditionally remove old wip database compact directory --- diff --git a/be/4ccf4cd7e02a36372cbbb94eaa6b95f0399795 b/be/4ccf4cd7e02a36372cbbb94eaa6b95f0399795 new file mode 100644 index 000000000..5e2cbd547 --- /dev/null +++ b/be/4ccf4cd7e02a36372cbbb94eaa6b95f0399795 @@ -0,0 +1,73 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 6A6DD431E64 + for ; Thu, 14 Nov 2013 14:03:43 -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 v9l1cqdpuLe7 for ; + Thu, 14 Nov 2013 14:03:35 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id F3E55431FBD + for ; Thu, 14 Nov 2013 14:03:34 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 5DDEC1000E5; Fri, 15 Nov 2013 00:03:30 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH v3 4/5] compact: unconditionally remove old wip database + compact directory +Date: Fri, 15 Nov 2013 00:03:26 +0200 +Message-Id: <1384466607-28298-2-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1384466607-28298-1-git-send-email-tomi.ollila@iki.fi> +References: + <1384466607-28298-1-git-send-email-tomi.ollila@iki.fi> +Cc: tomi.ollila@iki.fi +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: Thu, 14 Nov 2013 22:03:43 -0000 + +In case previous notmuch compact has been interrupted there is old +work-in-progress database compact directory partially filled. Remove +it just before starting to fill the directory with new files. +--- + lib/database.cc | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/lib/database.cc b/lib/database.cc +index d79cc30..d09ad99 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -922,6 +922,12 @@ notmuch_database_compact (const char *path, + goto DONE; + } + ++ /* Unconditionally attempt to remove old work-in-progress database (if ++ * any). This is "protected" by database lock. If this fails due to write ++ * errors (etc), the following code will fail and provide error message. ++ */ ++ (void) rmtree (compact_xapian_path); ++ + try { + NotmuchCompactor compactor (status_cb, closure); + +-- +1.8.0 +