From: Tomi Ollila Date: Mon, 11 Nov 2013 17:55:37 +0000 (+0200) Subject: [PATCH 2/3] lib: unconditionally attempt to remove old wip database compact directory X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e74fa36be07b736f6720042db54ff9d307b4fc29;p=notmuch-archives.git [PATCH 2/3] lib: unconditionally attempt to remove old wip database compact directory --- diff --git a/0f/1c8f1024f9b95429f85c73f578000cd10e13e0 b/0f/1c8f1024f9b95429f85c73f578000cd10e13e0 new file mode 100644 index 000000000..768aa3aa5 --- /dev/null +++ b/0f/1c8f1024f9b95429f85c73f578000cd10e13e0 @@ -0,0 +1,71 @@ +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 56029429E4F + for ; Mon, 11 Nov 2013 09:56:02 -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 LZUO+9-SOHtp for ; + Mon, 11 Nov 2013 09:55:56 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 8D889429E43 + for ; Mon, 11 Nov 2013 09:55:51 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 24F141000F2; Mon, 11 Nov 2013 19:55:45 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH 2/3] lib: unconditionally attempt to remove old wip database + compact directory +Date: Mon, 11 Nov 2013 19:55:37 +0200 +Message-Id: <1384192538-15291-3-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1384192538-15291-1-git-send-email-tomi.ollila@iki.fi> +References: <1384192538-15291-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: Mon, 11 Nov 2013 17:56:02 -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 | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/lib/database.cc b/lib/database.cc +index 6b656e9..78693b7 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -918,6 +918,11 @@ 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.3.1 +