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