[PATCH 3/3] compact: Provide user with more error feedback
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 15 Oct 2013 01:13:05 +0000 (21:13 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:25 +0000 (09:57 -0800)
ac/cd8a0a63c6dd6ce7c9abbe3859993a4891db5f [new file with mode: 0644]

diff --git a/ac/cd8a0a63c6dd6ce7c9abbe3859993a4891db5f b/ac/cd8a0a63c6dd6ce7c9abbe3859993a4891db5f
new file mode 100644 (file)
index 0000000..dbfe61f
--- /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 AAD27431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 14 Oct 2013 18:13:25 -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 PFnhoxUrcXyL for <notmuch@notmuchmail.org>;\r
+       Mon, 14 Oct 2013 18:13:19 -0700 (PDT)\r
+Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com\r
+       [209.85.216.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 40808431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 14 Oct 2013 18:13:15 -0700 (PDT)\r
+Received: by mail-qa0-f47.google.com with SMTP id k15so2734854qaq.20\r
+       for <notmuch@notmuchmail.org>; Mon, 14 Oct 2013 18:13:13 -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=IsbVoZWV/iJTZET2+vfs0WqvzmI7pzc5BhPNPZqMIwE=;\r
+       b=0GPfcyo3lhWuA/mYaWJZEdIEEh+zQrZK03GJJRaET5WKC4NRRkeiZishpYNCL4J+31\r
+       nc4z7wxJeVHwkZdIbM44lnubiJEo1bUdS+1iI2/V2LLrlGKOSJjgc8u/Gl19+4yfUXWm\r
+       scKW4kmFW8hc2bTG6roOopPQe23mypU8etYh36Ak1vJcdaIebVDizDmjUscOMAvPBtak\r
+       fyBwzu6/oMpvmdWuSyRKV3s3od5KTm62z/Mxf5+M2KBOMDYCCXiEcaN5zvN+j6fUcJb6\r
+       vpC5pVn8Xy7YGtrmSx2mxyYQzPETj6G7qA3cQ52C2+ZtCOhq0Zy/RbzEEqpX5BnTW50m\r
+       VqTg==\r
+X-Received: by 10.224.126.197 with SMTP id d5mr39129880qas.1.1381799593665;\r
+       Mon, 14 Oct 2013 18:13:13 -0700 (PDT)\r
+Received: from localhost.localdomain\r
+       (pool-108-8-224-250.spfdma.east.verizon.net. [108.8.224.250])\r
+       by mx.google.com with ESMTPSA id\r
+       og1sm105736333qeb.3.1969.12.31.16.00.00\r
+       (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);\r
+       Mon, 14 Oct 2013 18:13:13 -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: Mon, 14 Oct 2013 21:13:05 -0400\r
+Message-Id: <1381799585-16274-4-git-send-email-bgamari.foss@gmail.com>\r
+X-Mailer: git-send-email 1.8.1.2\r
+In-Reply-To: <1381799585-16274-1-git-send-email-bgamari.foss@gmail.com>\r
+References: <1381799585-16274-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: Tue, 15 Oct 2013 01:13: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.1.2\r
+\r