From: Ben Gamari Date: Mon, 28 Oct 2013 22:23:16 +0000 (+2000) Subject: [PATCH 3/4] compact: Provide user with more error feedback X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c418d332c64885e4f800f10ca40466608c55608f;p=notmuch-archives.git [PATCH 3/4] compact: Provide user with more error feedback --- diff --git a/7e/c450934330da73594fb05a59499d543e4a3b99 b/7e/c450934330da73594fb05a59499d543e4a3b99 new file mode 100644 index 000000000..64375c6dc --- /dev/null +++ b/7e/c450934330da73594fb05a59499d543e4a3b99 @@ -0,0 +1,105 @@ +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 70219429E27 + for ; Mon, 28 Oct 2013 15:23:37 -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 dqgx-p3JaPuR for ; + Mon, 28 Oct 2013 15:23:32 -0700 (PDT) +Received: from mail-qa0-f43.google.com (mail-qa0-f43.google.com + [209.85.216.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id ABD21431FDC + for ; Mon, 28 Oct 2013 15:23:29 -0700 (PDT) +Received: by mail-qa0-f43.google.com with SMTP id i13so2470571qae.16 + for ; Mon, 28 Oct 2013 15:23:29 -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=1RMpIh7lkzggCX4Ej1/SXAg2ruH08aYNxlYWyarLqe4=; + b=VvNQMnL0k19TH+lftme+59/s0QCb+fUtzMMphGTd4PL3b22wTsGy78usPei1ceNfgn + iJLcC6yplle/ygNP0ymcUk9wQ57OKvVIPJmGtGaCm0E7QvKay2NrGvSYTJ1ZKhhYroUQ + RUUDWIzD/vvj+CU7HOV3R72eMeR19FKAO2dZjVsXIOYA6OBRN010w/P3cAQvLj71eBoZ + wiz5lsVf1gU4yNHAsE429Wt7vvknKWaJHvWx9hZVeTepGj5y7hdFBe9ErgrNxWcDA0ow + FGSlT1q5Qg3q0QDXi3aqM2uW9bD832sCnsETY0Fl113QCRsnDljnz4Ol9iNQCGx4IRjJ + Xlqw== +X-Received: by 10.229.244.69 with SMTP id lp5mr32363218qcb.14.1382999009253; + Mon, 28 Oct 2013 15:23:29 -0700 (PDT) +Received: from ben-laptop.hasb.physics.cns (physicsnat56.physics.umass.edu. + [128.119.50.38]) + by mx.google.com with ESMTPSA id x1sm57796293qai.6.2013.10.28.15.23.28 + for + (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); + Mon, 28 Oct 2013 15:23:28 -0700 (PDT) +From: Ben Gamari +To: notmuch@notmuchmail.org +Subject: [PATCH 3/4] compact: Provide user with more error feedback +Date: Mon, 28 Oct 2013 18:23:16 -0400 +Message-Id: <1382998997-9938-3-git-send-email-bgamari.foss@gmail.com> +X-Mailer: git-send-email 1.8.3.2 +In-Reply-To: <1382998997-9938-1-git-send-email-bgamari.foss@gmail.com> +References: <1382998997-9938-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: Mon, 28 Oct 2013 22:23:37 -0000 + +Provide instructions on what to do when we couldn't move the compacted +database into place. + +Signed-off-by: Ben Gamari +--- + lib/database.cc | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 57c2292..34753ab 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -938,7 +938,25 @@ notmuch_database_compact (const char* path, + } + + if (rename(compact_xapian_path, xapian_path)) { +- fprintf (stderr, "Error moving compacted database\n"); ++ fprintf (stderr, "Error moving compacted database into place: %s\n", strerror(errno)); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "Encountered error while moving the compacted database\n"); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, " %s\n", compact_xapian_path); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "to\n"); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, " %s\n", xapian_path); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "Please identify the reason for this and move the compacted database\n"); ++ fprintf (stderr, "into place manually.\n"); ++ if (old_xapian_path != NULL) { ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "Alternatively you can revert to the uncompacted database with\n"); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, " mv %s %s\n", old_xapian_path, xapian_path); ++ fprintf (stderr, "\n"); ++ } + ret = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; + } +-- +1.8.3.2 +