1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 89150431FBD
\r
6 for <notmuch@notmuchmail.org>; Thu, 10 Apr 2014 06:26:12 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 8K53OS7Z2aiP for <notmuch@notmuchmail.org>;
\r
16 Thu, 10 Apr 2014 06:26:02 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 09214431FBC
\r
22 for <notmuch@notmuchmail.org>; Thu, 10 Apr 2014 06:26:01 -0700 (PDT)
\r
23 X-AuditID: 12074425-f79906d000000cf9-24-53469be7cfcc
\r
24 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
25 (using TLS with cipher AES256-SHA (256/256 bits))
\r
26 (Client did not present a certificate)
\r
27 by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP
\r
28 id 99.44.03321.7EB96435; Thu, 10 Apr 2014 09:25:59 -0400 (EDT)
\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
\r
30 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s3ADPxpa028278;
\r
31 Thu, 10 Apr 2014 09:25:59 -0400
\r
32 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
33 (authenticated bits=0)
\r
34 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
35 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s3ADPv6n016250
\r
36 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
37 Thu, 10 Apr 2014 09:25:58 -0400
\r
38 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
39 (envelope-from <amdragon@mit.edu>)
\r
40 id 1WYEzN-0003EK-Eq; Thu, 10 Apr 2014 09:25:57 -0400
\r
41 From: Austin Clements <amdragon@MIT.EDU>
\r
42 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
\r
43 Subject: Re: [Patch v7 5/6] notmuch-new: backup tags before database upgrade
\r
44 In-Reply-To: <1396712636-10640-6-git-send-email-david@tethera.net>
\r
45 References: <1396712636-10640-1-git-send-email-david@tethera.net>
\r
46 <1396712636-10640-6-git-send-email-david@tethera.net>
\r
47 User-Agent: Notmuch/0.17+167~g3863755 (http://notmuchmail.org) Emacs/23.4.1
\r
49 Date: Thu, 10 Apr 2014 09:25:57 -0400
\r
50 Message-ID: <8738hlxqmy.fsf@awakening.csail.mit.edu>
\r
52 Content-Type: text/plain; charset=us-ascii
\r
53 X-Brightmail-Tracker:
\r
54 H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsUixCmqrft8tluwwcwbNhY3WrsZLa7fnMns
\r
55 wOTxbNUtZo8th94zBzBFcdmkpOZklqUW6dslcGUsWriMteCJWMWLJb+YGhg/CnYxcnJICJhI
\r
56 LJqwhRHCFpO4cG89WxcjF4eQwGwmiR3XpjNCOBsZJWZPv8kE4Zxmkvi2qRUqs4RR4ty+Kawg
\r
57 /WwCGhLb9i8HmyUiYCfRc+E8O4gtLOAj8f79LiYQm1PASeL41DcsILaQQLlE76xGsBpRgXiJ
\r
58 1n6IXhYBVYmDb/vYQGxeoPveNi9ih7AFJU7OfALWyyygJXHj30umCYwCs5CkZiFJLWBkWsUo
\r
59 m5JbpZubmJlTnJqsW5ycmJeXWqRroZebWaKXmlK6iREUlOwuqjsYJxxSOsQowMGoxMN7YJlr
\r
60 sBBrYllxZe4hRkkOJiVRXrVJbsFCfEn5KZUZicUZ8UWlOanFhxglOJiVRHg3TgXK8aYkVlal
\r
61 FuXDpKQ5WJTEed9aWwULCaQnlqRmp6YWpBbBZGU4OJQkeNNnATUKFqWmp1akZeaUIKSZODhB
\r
62 hvMADV8EUsNbXJCYW5yZDpE/xagoJc5rBpIQAElklObB9cKSxitGcaBXhHmLQKp4gAkHrvsV
\r
63 0GAmoMGpdi4gg0sSEVJSDYzueSumyp3ceHV5/7P927IbZ/w/zqdyf6Xfm1m/+lKyjny7qsW3
\r
64 RfHfSZesy7zfZ646lyiteie88ICWymtv1osZOxfV//t1vV5swq51SpcvnI6xUlIrKbm+dJPz
\r
65 wdp7hz1P7nL5OFFgXn555a6wH6t/uXXNXjq3S2bPq/PMbpPNGNYnt06Sv5zCrMRSnJFoqMVc
\r
67 X-BeenThere: notmuch@notmuchmail.org
\r
68 X-Mailman-Version: 2.1.13
\r
70 List-Id: "Use and development of the notmuch mail system."
\r
71 <notmuch.notmuchmail.org>
\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
75 List-Post: <mailto:notmuch@notmuchmail.org>
\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
78 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
79 X-List-Received-Date: Thu, 10 Apr 2014 13:26:18 -0000
\r
81 On Sat, 05 Apr 2014, David Bremner <david@tethera.net> wrote:
\r
82 > All we do here is calculate the backup filename, and call the existing
\r
85 > Also take the opportity to add a message about being safe to
\r
91 > notmuch-new.c | 29 ++++++++++++++++++++++++++++-
\r
92 > test/T530-upgrade.sh | 4 +++-
\r
93 > 2 files changed, 31 insertions(+), 2 deletions(-)
\r
95 > diff --git a/notmuch-new.c b/notmuch-new.c
\r
96 > index 82acf69..d269c7c 100644
\r
97 > --- a/notmuch-new.c
\r
98 > +++ b/notmuch-new.c
\r
99 > @@ -989,8 +989,35 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
\r
100 > return EXIT_FAILURE;
\r
102 > if (notmuch_database_needs_upgrade (notmuch)) {
\r
103 > - if (add_files_state.verbosity >= VERBOSITY_NORMAL)
\r
104 > + time_t now = time (NULL);
\r
105 > + struct tm *gm_time = gmtime (&now);
\r
107 > + /* since dump files are written atomically, the amount of
\r
108 > + * harm from overwriting one within a second seems
\r
109 > + * relatively small. */
\r
111 > + const char *backup_name =
\r
112 > + talloc_asprintf (notmuch, "%s/dump-%04d%02d%02dT%02d%02d%02d.gz",
\r
113 > + dot_notmuch_path,
\r
114 > + gm_time->tm_year + 1900,
\r
115 > + gm_time->tm_mon + 1,
\r
116 > + gm_time->tm_mday,
\r
117 > + gm_time->tm_hour,
\r
118 > + gm_time->tm_min,
\r
119 > + gm_time->tm_sec);
\r
121 > + if (add_files_state.verbosity >= VERBOSITY_NORMAL) {
\r
122 > printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");
\r
123 > + printf ("This process is safe to interrupt.\n");
\r
124 > + printf ("Backing up tags to %s...\n", backup_name);
\r
127 > + if (notmuch_database_dump (notmuch, backup_name, "",
\r
128 > + DUMP_FORMAT_BATCH_TAG, TRUE)) {
\r
129 > + fprintf (stderr, "Backup failed. Aborting upgrade.");
\r
130 > + return EXIT_FAILURE;
\r
133 > gettimeofday (&add_files_state.tv_start, NULL);
\r
134 > notmuch_database_upgrade (notmuch,
\r
135 > add_files_state.verbosity >= VERBOSITY_NORMAL ? upgrade_print_progress : NULL,
\r
136 > diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh
\r
137 > index 67bbf31..d46e3d1 100755
\r
138 > --- a/test/T530-upgrade.sh
\r
139 > +++ b/test/T530-upgrade.sh
\r
140 > @@ -26,9 +26,11 @@ output=$(notmuch search path:foo)
\r
141 > test_expect_equal "$output" ""
\r
143 > test_begin_subtest "database upgrade from format version 1"
\r
144 > -output=$(notmuch new)
\r
145 > +output=$(notmuch new | sed -e 's/^Backing up tags to .*$/Backing up tags to FILENAME/')
\r
146 > test_expect_equal "$output" "\
\r
147 > Welcome to a new version of notmuch! Your database will now be upgraded.
\r
148 > +This process is safe to interrupt.
\r
149 > +Backing up tags to FILENAME
\r
150 > Your notmuch database has now been upgraded to database format version 2.
\r
156 > _______________________________________________
\r
157 > notmuch mailing list
\r
158 > notmuch@notmuchmail.org
\r
159 > http://notmuchmail.org/mailman/listinfo/notmuch
\r