unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ben Gamari <bgamari.foss@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 3/4] compact: Provide user with more error feedback
Date: Mon, 28 Oct 2013 18:23:16 -0400	[thread overview]
Message-ID: <1382998997-9938-3-git-send-email-bgamari.foss@gmail.com> (raw)
In-Reply-To: <1382998997-9938-1-git-send-email-bgamari.foss@gmail.com>

Provide instructions on what to do when we couldn't move the compacted
database into place.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
---
 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

  parent reply	other threads:[~2013-10-28 22:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 22:23 [PATCH 1/4] test: Add compact test Ben Gamari
2013-10-28 22:23 ` [PATCH 2/4] compact: Give user more feedback on failure renaming Ben Gamari
2013-10-28 22:23 ` Ben Gamari [this message]
2013-10-28 22:23 ` [PATCH 4/4] database: Handle error while deleting uncompacted database Ben Gamari
2013-11-02 12:23   ` David Bremner
2013-11-04 20:06     ` Ben Gamari
2013-10-29 11:03 ` [PATCH 1/4] test: Add compact test Tomi Ollila
2013-10-31  4:10   ` Ben Gamari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382998997-9938-3-git-send-email-bgamari.foss@gmail.com \
    --to=bgamari.foss@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).