[PATCH 2/3] compact: Give user more feedback on failure renaming
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 15 Oct 2013 01:13:04 +0000 (21:13 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:25 +0000 (09:57 -0800)
30/1a3213b9f13232fe95c567e5da86891f10c0cb [new file with mode: 0644]

diff --git a/30/1a3213b9f13232fe95c567e5da86891f10c0cb b/30/1a3213b9f13232fe95c567e5da86891f10c0cb
new file mode 100644 (file)
index 0000000..a9d4c54
--- /dev/null
@@ -0,0 +1,94 @@
+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 3D2EA431FCB\r
+       for <notmuch@notmuchmail.org>; Mon, 14 Oct 2013 18:13:24 -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 x8fYobOyICAE for <notmuch@notmuchmail.org>;\r
+       Mon, 14 Oct 2013 18:13:19 -0700 (PDT)\r
+Received: from mail-qc0-f170.google.com (mail-qc0-f170.google.com\r
+       [209.85.216.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 6AC0B431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 14 Oct 2013 18:13:14 -0700 (PDT)\r
+Received: by mail-qc0-f170.google.com with SMTP id n9so2453341qcw.15\r
+       for <notmuch@notmuchmail.org>; Mon, 14 Oct 2013 18:13:12 -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=+hROSYcoG8KzSm0D0Kf3UyTBAyQsg3seDgzTXUKeIVE=;\r
+       b=f0lCnZ6NmPbsxcU16P3LfFoTuaMDeZ8g3gIHd/gb9H+ZNA8JqCAryN4pJjv6WI8ZBk\r
+       J5wmXVthFcseleQAfHgHlZIurOeVrS1YC+GSqc9SW4FMYJdLpEz0H1+lLn99jD5gT4A3\r
+       KOWQJO05pr2Ds0P4AuSHvj5P+S5kvwOMr8dF+a05Swf9yfTK/D8H4SmLgBdNXn4DnT5G\r
+       c1cL/4lo/bRB5r705Z+lV8q4QYuX82b/CtCIKWrU7rwoVQSi1xVSYX+cIvDIgpsO4tpr\r
+       F8HKUvfP4Tk5mZ6lv4CJoZRdfq0dc8vMw8a5A4xPYybHJ1MEzFn3hfpKs+F3GcV+ZEha\r
+       fGMg==\r
+X-Received: by 10.229.65.201 with SMTP id k9mr42011135qci.11.1381799592837;\r
+       Mon, 14 Oct 2013 18:13:12 -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:12 -0700 (PDT)\r
+From: Ben Gamari <bgamari.foss@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] compact: Give user more feedback on failure renaming\r
+Date: Mon, 14 Oct 2013 21:13:04 -0400\r
+Message-Id: <1381799585-16274-3-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:24 -0000\r
+\r
+Provide the user with instructions after we fail to move the old\r
+un-compacted database out of the way.\r
+\r
+Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>\r
+---\r
+ lib/database.cc | 9 ++++++++-\r
+ 1 file changed, 8 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 06f1c0a..57c2292 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -922,7 +922,14 @@ notmuch_database_compact (const char* path,\r
\r
+     if (old_xapian_path != NULL) {\r
+       if (rename(xapian_path, old_xapian_path)) {\r
+-          fprintf (stderr, "Error moving old database out of the way\n");\r
++          fprintf (stderr, "Error moving old database out of the way: %s\n",\r
++                   strerror(errno));\r
++          fprintf (stderr, "\n");\r
++          fprintf (stderr, "Old database: %s\n", xapian_path);\r
++          fprintf (stderr, "Compacted database: %s\n", compact_xapian_path);\r
++          fprintf (stderr, "\n");\r
++          fprintf (stderr, "At this point it's probably best to remove the compacted database,\n");\r
++          fprintf (stderr, "find the cause of this error, and try compacting again.\n");\r
+           ret = NOTMUCH_STATUS_FILE_ERROR;\r
+           goto DONE;\r
+       }\r
+-- \r
+1.8.1.2\r
+\r