From bf6b428a2eafc834ccae9130a3d7c6ff979e9bd6 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 28 Oct 2013 16:30:06 +2000 Subject: [PATCH] [PATCH 2/3] compact: Give user more feedback on failure renaming --- 2d/2de01c6dbb4c0ed472a44fa40c42887b7f5ce7 | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 2d/2de01c6dbb4c0ed472a44fa40c42887b7f5ce7 diff --git a/2d/2de01c6dbb4c0ed472a44fa40c42887b7f5ce7 b/2d/2de01c6dbb4c0ed472a44fa40c42887b7f5ce7 new file mode 100644 index 000000000..49fdcf6cc --- /dev/null +++ b/2d/2de01c6dbb4c0ed472a44fa40c42887b7f5ce7 @@ -0,0 +1,94 @@ +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 5D486429E5D + for ; Sun, 27 Oct 2013 13:30:28 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 Q0jGhxSfi6xb for ; + Sun, 27 Oct 2013 13:30:23 -0700 (PDT) +Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com + [209.85.216.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 260BD429E3A + for ; Sun, 27 Oct 2013 13:30:20 -0700 (PDT) +Received: by mail-qc0-f182.google.com with SMTP id n7so3328618qcx.41 + for ; Sun, 27 Oct 2013 13:30:18 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=7X+fb0nSeZE2BNT42DDJTouunzR/OzzOAC/Lbh58NS4=; + b=1HUUJdUzdkbg+V2GElO5lcvHGmNqZ2wk6NusjFi2wZC43NsNKvbAJat1C06s4Kz0MA + lBtb3GvnWf+aYuBaAJXVgq/tY8fm8K74mxESfZ1tTOXl4qshvUQQfLZW5aPE29zi7yhX + KLHsf7SEEltaFAAWe9168SxJNFTQA5+3qsoLgsJv/xjRxMDQif7ZxqKPTqqKBmEJ1pjB + jqQKBuOhAYjHxWh0J6HEprHklz5BGiLiDGm5fVIbGQVuHCCcSX4JuGL4RHsRZ72Vw7r4 + auQHV2tDTrsu1Ie1ILo2QQBxh3MlyT3kKpwOlOuUJD4QpsP6WLgbnetsODdd+mmfCjxs + piDg== +X-Received: by 10.224.54.209 with SMTP id r17mr25780250qag.16.1382905818494; + Sun, 27 Oct 2013 13:30:18 -0700 (PDT) +Received: from localhost.localdomain + (pool-96-240-254-51.spfdma.east.verizon.net. [96.240.254.51]) + by mx.google.com with ESMTPSA id x1sm45270525qai.6.2013.10.27.13.30.17 + for + (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); + Sun, 27 Oct 2013 13:30:18 -0700 (PDT) +From: Ben Gamari +To: notmuch@notmuchmail.org +Subject: [PATCH 2/3] compact: Give user more feedback on failure renaming +Date: Sun, 27 Oct 2013 16:30:06 -0400 +Message-Id: <1382905807-22220-2-git-send-email-bgamari.foss@gmail.com> +X-Mailer: git-send-email 1.8.3.2 +In-Reply-To: <1382905807-22220-1-git-send-email-bgamari.foss@gmail.com> +References: <1382905807-22220-1-git-send-email-bgamari.foss@gmail.com> +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: Sun, 27 Oct 2013 20:30:28 -0000 + +Provide the user with instructions after we fail to move the old +un-compacted database out of the way. + +Signed-off-by: Ben Gamari +--- + lib/database.cc | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 06f1c0a..57c2292 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -922,7 +922,14 @@ notmuch_database_compact (const char* path, + + if (old_xapian_path != NULL) { + if (rename(xapian_path, old_xapian_path)) { +- fprintf (stderr, "Error moving old database out of the way\n"); ++ fprintf (stderr, "Error moving old database out of the way: %s\n", ++ strerror(errno)); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "Old database: %s\n", xapian_path); ++ fprintf (stderr, "Compacted database: %s\n", compact_xapian_path); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "At this point it's probably best to remove the compacted database,\n"); ++ fprintf (stderr, "find the cause of this error, and try compacting again.\n"); + ret = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; + } +-- +1.8.3.2 + -- 2.26.2