From 40fbc3eb437d86c51c575840e0cd703dd0afad1a Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Tue, 15 Oct 2013 21:13:04 +2000 Subject: [PATCH] [PATCH 2/3] compact: Give user more feedback on failure renaming --- 30/1a3213b9f13232fe95c567e5da86891f10c0cb | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 30/1a3213b9f13232fe95c567e5da86891f10c0cb diff --git a/30/1a3213b9f13232fe95c567e5da86891f10c0cb b/30/1a3213b9f13232fe95c567e5da86891f10c0cb new file mode 100644 index 000000000..a9d4c54c3 --- /dev/null +++ b/30/1a3213b9f13232fe95c567e5da86891f10c0cb @@ -0,0 +1,94 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 3D2EA431FCB + for ; Mon, 14 Oct 2013 18:13:24 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id x8fYobOyICAE for ; + Mon, 14 Oct 2013 18:13:19 -0700 (PDT) +Received: from mail-qc0-f170.google.com (mail-qc0-f170.google.com + [209.85.216.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 6AC0B431FB6 + for ; Mon, 14 Oct 2013 18:13:14 -0700 (PDT) +Received: by mail-qc0-f170.google.com with SMTP id n9so2453341qcw.15 + for ; Mon, 14 Oct 2013 18:13:12 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=+hROSYcoG8KzSm0D0Kf3UyTBAyQsg3seDgzTXUKeIVE=; + b=f0lCnZ6NmPbsxcU16P3LfFoTuaMDeZ8g3gIHd/gb9H+ZNA8JqCAryN4pJjv6WI8ZBk + J5wmXVthFcseleQAfHgHlZIurOeVrS1YC+GSqc9SW4FMYJdLpEz0H1+lLn99jD5gT4A3 + KOWQJO05pr2Ds0P4AuSHvj5P+S5kvwOMr8dF+a05Swf9yfTK/D8H4SmLgBdNXn4DnT5G + c1cL/4lo/bRB5r705Z+lV8q4QYuX82b/CtCIKWrU7rwoVQSi1xVSYX+cIvDIgpsO4tpr + F8HKUvfP4Tk5mZ6lv4CJoZRdfq0dc8vMw8a5A4xPYybHJ1MEzFn3hfpKs+F3GcV+ZEha + fGMg== +X-Received: by 10.229.65.201 with SMTP id k9mr42011135qci.11.1381799592837; + Mon, 14 Oct 2013 18:13:12 -0700 (PDT) +Received: from localhost.localdomain + (pool-108-8-224-250.spfdma.east.verizon.net. [108.8.224.250]) + by mx.google.com with ESMTPSA id + og1sm105736333qeb.3.1969.12.31.16.00.00 + (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); + Mon, 14 Oct 2013 18:13:12 -0700 (PDT) +From: Ben Gamari +To: notmuch@notmuchmail.org +Subject: [PATCH 2/3] compact: Give user more feedback on failure renaming +Date: Mon, 14 Oct 2013 21:13:04 -0400 +Message-Id: <1381799585-16274-3-git-send-email-bgamari.foss@gmail.com> +X-Mailer: git-send-email 1.8.1.2 +In-Reply-To: <1381799585-16274-1-git-send-email-bgamari.foss@gmail.com> +References: <1381799585-16274-1-git-send-email-bgamari.foss@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 15 Oct 2013 01:13:24 -0000 + +Provide the user with instructions after we fail to move the old +un-compacted database out of the way. + +Signed-off-by: Ben Gamari +--- + lib/database.cc | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 06f1c0a..57c2292 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -922,7 +922,14 @@ notmuch_database_compact (const char* path, + + if (old_xapian_path != NULL) { + if (rename(xapian_path, old_xapian_path)) { +- fprintf (stderr, "Error moving old database out of the way\n"); ++ fprintf (stderr, "Error moving old database out of the way: %s\n", ++ strerror(errno)); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "Old database: %s\n", xapian_path); ++ fprintf (stderr, "Compacted database: %s\n", compact_xapian_path); ++ fprintf (stderr, "\n"); ++ fprintf (stderr, "At this point it's probably best to remove the compacted database,\n"); ++ fprintf (stderr, "find the cause of this error, and try compacting again.\n"); + ret = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; + } +-- +1.8.1.2 + -- 2.26.2