Re: A systematic way of handling Xapian lock errors?
[notmuch-archives.git] / 8b / aac0783796e757a558c0972b553b8c93dac65a
1 Return-Path: <david@tethera.net>\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 arlo.cworth.org (Postfix) with ESMTP id 97F6C6DE021E\r
6  for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 05:58:54 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.125\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.125 tagged_above=-999 required=5 tests=[AWL=0.125]\r
12  autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id ZzCkr77msS7v for <notmuch@notmuchmail.org>;\r
16  Sun, 16 Aug 2015 05:58:52 -0700 (PDT)\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
18  by arlo.cworth.org (Postfix) with ESMTPS id A74F16DE009A\r
19  for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 05:58:52 -0700 (PDT)\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
21  (envelope-from <david@tethera.net>)\r
22  id 1ZQxVk-0002n2-Bl; Sun, 16 Aug 2015 12:58:04 +0000\r
23 Received: (nullmailer pid 17358 invoked by uid 1000); Sun, 16 Aug 2015\r
24  12:57:54 -0000\r
25 From: David Bremner <david@tethera.net>\r
26 To: David Mazieres <dm-list-email-notmuch@scs.stanford.edu>,\r
27  notmuch@notmuchmail.org\r
28 Subject: Re: Enabling and disabling maildir.synchronize_flags\r
29 In-Reply-To: <874mjzblwc.fsf@ta.scs.stanford.edu>\r
30 References: <87r3orbqfn.fsf@ta.scs.stanford.edu>\r
31  <87r3n3fu7d.fsf@maritornes.cs.unb.ca> <874mjzblwc.fsf@ta.scs.stanford.edu>\r
32 User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1\r
33  (x86_64-pc-linux-gnu)\r
34 Date: Sun, 16 Aug 2015 14:57:54 +0200\r
35 Message-ID: <87614ffl0t.fsf@maritornes.cs.unb.ca>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.18\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42  <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sun, 16 Aug 2015 12:58:54 -0000\r
51 \r
52 David Mazieres <dm-list-email-notmuch@scs.stanford.edu> writes:\r
53 \r
54 \r
55 > So my question remains, what's the easiest safe way to re-enable\r
56 > synchronize_flags after disabling it?  (Safe meaning it won't change any\r
57 > tags.)  It could be that there's a very simple answer, in which case\r
58 > sticking it in the man page might be nice.\r
59 \r
60 I can't think of a simple, safe, and fast answer.\r
61 \r
62 As a hack, if you run notmuch new right before you enable\r
63 synchronize_flags, then next the next notmuch new will not notice the\r
64 fact that flags are out of sync [1]. I don't think this really qualifies\r
65 as safe, as the fact that the maildir is out of sync with the database\r
66 will eventually bite you. Maybe in some special circumstances this\r
67 helps.\r
68 \r
69 Otherwise, two things to that might speed up the process.\r
70 \r
71 1) dump and restore both take queries, so you can only worry about the\r
72 maildir relevant flags.\r
73 \r
74 2) when the lastmod changes go in, it seems like you could run the first\r
75    notmuch new after enabling tag synchonizing, and dump only the tag\r
76    changes since a checkpoint lastmod value. This would allow rolling\r
77    back the unwanted tag changes.\r
78 \r
79 \r
80 [1]: see this potential test, if for some reason we wanted to\r
81      guarantee this behaviours.\r
82      \r
83 test_begin_subtest "Turning on maildir.synchronize_flags w/o backup"\r
84 OLDCONFIG=$(notmuch config get maildir.synchronize_flags)\r
85 \r
86 notmuch config set maildir.synchronize_flags true\r
87 add_message [subject]='"Message to test ignoring flags"' \\r
88     [date]='"Sat, 01 Jan 2000 12:00:00 -0000"' \\r
89     [filename]='ignoring-flags' [dir]=cur\r
90 ${NOTMUCH_NEW}\r
91 notmuch dump > EXPECTED\r
92 \r
93 notmuch config set maildir.synchronize_flags false\r
94 # make flags out of sync with db\r
95 mv ${MAIL_DIR}/cur/ignoring-flags ${MAIL_DIR}/cur/ignoring-flags,S\r
96 ${NOTMUCH_NEW}\r
97 \r
98 notmuch config set maildir.synchronize_flags true\r
99 ${NOTMUCH_NEW}\r
100 notmuch dump > OUTPUT\r
101 notmuch config set maildir.synchronize_flags "${OLDCONFIG}"\r
102 test_expect_equal_file EXPECTED OUTPUT\r