[PATCH 3/4] compact: Provide user with more error feedback
authorBen Gamari <bgamari.foss@gmail.com>
Mon, 28 Oct 2013 22:23:16 +0000 (18:23 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:45 +0000 (09:57 -0800)
7e/c450934330da73594fb05a59499d543e4a3b99 [new file with mode: 0644]

diff --git a/7e/c450934330da73594fb05a59499d543e4a3b99 b/7e/c450934330da73594fb05a59499d543e4a3b99
new file mode 100644 (file)
index 0000000..64375c6
--- /dev/null
@@ -0,0 +1,105 @@
+Return-Path: <bgamari.foss@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 70219429E27\r
+       for <notmuch@notmuchmail.org>; Mon, 28 Oct 2013 15:23:37 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id dqgx-p3JaPuR for <notmuch@notmuchmail.org>;\r
+       Mon, 28 Oct 2013 15:23:32 -0700 (PDT)\r
+Received: from mail-qa0-f43.google.com (mail-qa0-f43.google.com\r
+       [209.85.216.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id ABD21431FDC\r
+       for <notmuch@notmuchmail.org>; Mon, 28 Oct 2013 15:23:29 -0700 (PDT)\r
+Received: by mail-qa0-f43.google.com with SMTP id i13so2470571qae.16\r
+       for <notmuch@notmuchmail.org>; Mon, 28 Oct 2013 15:23:29 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+       bh=1RMpIh7lkzggCX4Ej1/SXAg2ruH08aYNxlYWyarLqe4=;\r
+       b=VvNQMnL0k19TH+lftme+59/s0QCb+fUtzMMphGTd4PL3b22wTsGy78usPei1ceNfgn\r
+       iJLcC6yplle/ygNP0ymcUk9wQ57OKvVIPJmGtGaCm0E7QvKay2NrGvSYTJ1ZKhhYroUQ\r
+       RUUDWIzD/vvj+CU7HOV3R72eMeR19FKAO2dZjVsXIOYA6OBRN010w/P3cAQvLj71eBoZ\r
+       wiz5lsVf1gU4yNHAsE429Wt7vvknKWaJHvWx9hZVeTepGj5y7hdFBe9ErgrNxWcDA0ow\r
+       FGSlT1q5Qg3q0QDXi3aqM2uW9bD832sCnsETY0Fl113QCRsnDljnz4Ol9iNQCGx4IRjJ\r
+       Xlqw==\r
+X-Received: by 10.229.244.69 with SMTP id lp5mr32363218qcb.14.1382999009253;\r
+       Mon, 28 Oct 2013 15:23:29 -0700 (PDT)\r
+Received: from ben-laptop.hasb.physics.cns (physicsnat56.physics.umass.edu.\r
+       [128.119.50.38])\r
+       by mx.google.com with ESMTPSA id x1sm57796293qai.6.2013.10.28.15.23.28\r
+       for <multiple recipients>\r
+       (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);\r
+       Mon, 28 Oct 2013 15:23:28 -0700 (PDT)\r
+From: Ben Gamari <bgamari.foss@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/4] compact: Provide user with more error feedback\r
+Date: Mon, 28 Oct 2013 18:23:16 -0400\r
+Message-Id: <1382998997-9938-3-git-send-email-bgamari.foss@gmail.com>\r
+X-Mailer: git-send-email 1.8.3.2\r
+In-Reply-To: <1382998997-9938-1-git-send-email-bgamari.foss@gmail.com>\r
+References: <1382998997-9938-1-git-send-email-bgamari.foss@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 28 Oct 2013 22:23:37 -0000\r
+\r
+Provide instructions on what to do when we couldn't move the compacted\r
+database into place.\r
+\r
+Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>\r
+---\r
+ lib/database.cc | 20 +++++++++++++++++++-\r
+ 1 file changed, 19 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 57c2292..34753ab 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -938,7 +938,25 @@ notmuch_database_compact (const char* path,\r
+     }\r
\r
+     if (rename(compact_xapian_path, xapian_path)) {\r
+-      fprintf (stderr, "Error moving compacted database\n");\r
++      fprintf (stderr, "Error moving compacted database into place: %s\n", strerror(errno));\r
++      fprintf (stderr, "\n");\r
++      fprintf (stderr, "Encountered error while moving the compacted database\n");\r
++      fprintf (stderr, "\n");\r
++      fprintf (stderr, "    %s\n", compact_xapian_path);\r
++      fprintf (stderr, "\n");\r
++      fprintf (stderr, "to\n");\r
++      fprintf (stderr, "\n");\r
++      fprintf (stderr, "    %s\n", xapian_path);\r
++      fprintf (stderr, "\n");\r
++      fprintf (stderr, "Please identify the reason for this and move the compacted database\n");\r
++      fprintf (stderr, "into place manually.\n");\r
++      if (old_xapian_path != NULL) {\r
++          fprintf (stderr, "\n");\r
++          fprintf (stderr, "Alternatively you can revert to the uncompacted database with\n");\r
++          fprintf (stderr, "\n");\r
++          fprintf (stderr, "    mv %s %s\n", old_xapian_path, xapian_path);\r
++          fprintf (stderr, "\n");\r
++      }\r
+       ret = NOTMUCH_STATUS_FILE_ERROR;\r
+       goto DONE;\r
+     }\r
+-- \r
+1.8.3.2\r
+\r