From 9bb45ae726b000db611d3f8ea5d30c295c1bd94f Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Wed, 13 Nov 2013 19:02:46 +0200 Subject: [PATCH] [PATCH v2 4/5] compact: unconditionally attempt to remove old wip database compact directory --- 61/c3cf79bb9c2df476269d4687aabbb872235cc7 | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 61/c3cf79bb9c2df476269d4687aabbb872235cc7 diff --git a/61/c3cf79bb9c2df476269d4687aabbb872235cc7 b/61/c3cf79bb9c2df476269d4687aabbb872235cc7 new file mode 100644 index 000000000..b3c3177c8 --- /dev/null +++ b/61/c3cf79bb9c2df476269d4687aabbb872235cc7 @@ -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 39D8A429E37 + for ; Wed, 13 Nov 2013 09:03:09 -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 HzBv2vdlEpDS for ; + Wed, 13 Nov 2013 09:03:03 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 120EF431FD2 + for ; Wed, 13 Nov 2013 09:02:57 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id C19441000F2; Wed, 13 Nov 2013 19:02:52 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH v2 4/5] compact: unconditionally attempt to remove old wip + database compact directory +Date: Wed, 13 Nov 2013 19:02:46 +0200 +Message-Id: <1384362167-12740-5-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1384362167-12740-1-git-send-email-tomi.ollila@iki.fi> +References: <1384362167-12740-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: Wed, 13 Nov 2013 17:03:09 -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 ee09c5e..4b5ac64 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -920,6 +920,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 + -- 2.26.2