[PATCH 3/3] compact: Provide user with more error feedback
authorBen Gamari <bgamari.foss@gmail.com>
Sun, 27 Oct 2013 20:30:07 +0000 (16:30 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:43 +0000 (09:57 -0800)
ea/5497e1d8e42d47b3613bed7149e41f06b9d816 [new file with mode: 0644]

diff --git a/ea/5497e1d8e42d47b3613bed7149e41f06b9d816 b/ea/5497e1d8e42d47b3613bed7149e41f06b9d816
new file mode 100644 (file)
index 0000000..0059bda
--- /dev/null
@@ -0,0 +1,103 @@
+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 3BCD2429E5D\r
+       for <notmuch@notmuchmail.org>; Sun, 27 Oct 2013 13:30:26 -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 5oBM7J4SRS1A for <notmuch@notmuchmail.org>;\r
+       Sun, 27 Oct 2013 13:30:19 -0700 (PDT)\r
+Received: from mail-qe0-f48.google.com (mail-qe0-f48.google.com\r
+       [209.85.128.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D8C37429E38\r
+       for <notmuch@notmuchmail.org>; Sun, 27 Oct 2013 13:30:19 -0700 (PDT)\r
+Received: by mail-qe0-f48.google.com with SMTP id d4so3579920qej.35\r
+       for <notmuch@notmuchmail.org>; Sun, 27 Oct 2013 13:30:19 -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=jq8lOOErg+iq/0R86inkbqUue+z82pSSJu0UFpGmMu8=;\r
+       b=q1p9XkQfic7wIVlgN/1SMdcajHq35I2QemwjW2nkGPYl6TUsxnNN1gKtw3zV+5wg/r\r
+       rAJ99uMqW0zmBUaZvSuJ/g/fjvEhPRQtUvRhM4pFFNMRrh0XUZNyMQaon/cOprU7hgcF\r
+       8pHBpPOn4TfshKGJFtQ8GVtS9DjJ39ksAnSA4dD2L1GdIAvcVnOGW65+za4Ep9XiNVcF\r
+       FgMv00IfWSQKgWKcLwng+Z9Bx6ADAQPiqsLa4ZdkKMrlVEQ8uerPLYKzX2rI8Tzen1Ke\r
+       J0kSDbhYO0tyY93C+Yf+zTdQ07fKXAMriteDlh4gpcrtcbuwz6EdVt8FySYVh6Q/ok3D\r
+       Zofg==\r
+X-Received: by 10.49.51.170 with SMTP id l10mr24742541qeo.46.1382905819437;\r
+       Sun, 27 Oct 2013 13:30:19 -0700 (PDT)\r
+Received: from localhost.localdomain\r
+       (pool-96-240-254-51.spfdma.east.verizon.net. [96.240.254.51])\r
+       by mx.google.com with ESMTPSA id x1sm45270525qai.6.2013.10.27.13.30.18\r
+       for <multiple recipients>\r
+       (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);\r
+       Sun, 27 Oct 2013 13:30:19 -0700 (PDT)\r
+From: Ben Gamari <bgamari.foss@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/3] compact: Provide user with more error feedback\r
+Date: Sun, 27 Oct 2013 16:30:07 -0400\r
+Message-Id: <1382905807-22220-3-git-send-email-bgamari.foss@gmail.com>\r
+X-Mailer: git-send-email 1.8.3.2\r
+In-Reply-To: <1382905807-22220-1-git-send-email-bgamari.foss@gmail.com>\r
+References: <1382905807-22220-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: Sun, 27 Oct 2013 20:30:26 -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 | 18 +++++++++++++++++-\r
+ 1 file changed, 17 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 57c2292..6f9fed1 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -938,7 +938,23 @@ 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 %s while moving the compacted database,\n",\r
++               strerror(errno));\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 into place manually.\n");\r
++      if (backup_path != NULL) {\r
++          fprintf (stderr, "Otherwise, you can revert to the backup database located at,\n");\r
++          fprintf (stderr, "\n");\r
++          fprintf (stderr, "    %s\n", backup_path);\r
++      }\r
+       ret = NOTMUCH_STATUS_FILE_ERROR;\r
+       goto DONE;\r
+     }\r
+-- \r
+1.8.3.2\r
+\r