Re: Flat search and threaded views
[notmuch-archives.git] / 02 / 2a8842aa8499286dfb646fc9b7289fe8ae6f7c
1 Return-Path: <tomi.ollila@iki.fi>\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 D63F5431FDA\r
6         for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 10:58:39 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 wx3KBlz2jj80 for <notmuch@notmuchmail.org>;\r
16         Tue, 12 Nov 2013 10:58:31 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id C6414431FD7\r
19         for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 10:58:30 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id EBF34100033\r
22         for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 20:58:24 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: notmuch@notmuchmail.org\r
25 Subject: Re: compactor adjustments\r
26 In-Reply-To: <1384192538-15291-1-git-send-email-tomi.ollila@iki.fi>\r
27 References: <1384192538-15291-1-git-send-email-tomi.ollila@iki.fi>\r
28 User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Tue, 12 Nov 2013 20:58:24 +0200\r
34 Message-ID: <m2fvr1tpkf.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Tue, 12 Nov 2013 18:58:40 -0000\r
50 \r
51 On Mon, Nov 11 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
52 \r
53 > Hi\r
54 >\r
55 > I think these changes would be good to have in use before notmuch compact\r
56 > is in wider usage.\r
57 >\r
58 > All tests pass. I plan to test all of these code paths manually tomorrow.\r
59 > If anyone comes up with good plan how to add automatic tests I'll add\r
60 > those too (I also think myself, haven't got any good ones yet).\r
61 \r
62 I made this change to the code:\r
63 \r
64 diff --git a/lib/database.cc b/lib/database.cc\r
65 index 40272dc..ad7002b 100644\r
66 --- a/lib/database.cc\r
67 +++ b/lib/database.cc\r
68 @@ -933,2 +933,2 @@ notmuch_database_compact (const char* path,\r
69 -    } catch (Xapian::InvalidArgumentError e) {\r
70 -       fprintf (stderr, "Error while compacting: %s\n", e.get_msg().c_str());\r
71 +    } catch (Xapian::Error &error) {\r
72 +       fprintf (stderr, "Error while compacting: %s\n", error.get_msg().c_str());\r
73 \r
74 Now it is consistent with other code and also doesn't crash on other errors\r
75 \r
76 I did the following tests:\r
77 \r
78 \r
79 $ pwd\r
80 /path/to/.notmuch\r
81 \r
82 \r
83 $ mkdir xapian.old\r
84 $ notmuch compact\r
85 Compacting database...\r
86 Backup path already exists: /path/to/.notmuch/xapian.old\r
87 Compaction failed: Something went wrong trying to read or write a file\r
88 zsh: exit 1     ./notmuch compact\r
89 \r
90 \r
91 $ : tried to make compact fail by doing:\r
92 $ : mkdir xapian.compact / touch xapian.compact + chmod 000 xapian.compact\r
93 $ : notmuch compact worked OK after the above.\r
94 \r
95 \r
96 $ chmod 555 .\r
97 $ notmuch compact\r
98 Compacting database...\r
99 Error while compacting: /path/to/.notmuch/xapian.compact:\r
100 cannot create directory\r
101 Compaction failed: A Xapian exception occurred\r
102 zsh: exit 1     ./notmuch compact\r
103 \r
104 \r
105 $ chmod 755 .\r
106 $ notmuch compact --backup=/tmp/exdev\r
107 Compacting database...\r
108 ...\r
109 ...\r
110 ...\r
111 Error moving old database out of the way:\r
112 Old database: /path/to/.notmuch/xapian\r
113 Backup database: /tmp/exdev\r
114 Error: Invalid cross-device link\r
115 Compaction failed: Something went wrong trying to read or write a file\r
116 zsh: exit 1     ./notmuch compact --backup=/tmp/exdev\r
117 \r
118 \r
119 $ : here I tried all I could think of (that doesn't include modifying\r
120 $ : permissions on the fly (perhaps in lib/database.cc code!), but\r
121 $ : could not get  if (rename(compact_xapian_path, xapian_path)) {\r
122 $ : fail. i.e. it is possible although highly unlikely (which is good). \r
123 \r
124 \r
125 $ chmod 555 xapian\r
126 Compacting database...\r
127 ...\r
128 ...\r
129 ...\r
130 Error removing backup database: Permission denied\r
131 \r
132 Please remove the backup database with\r
133 \r
134    rm -rf '/path/to/.notmuch/xapian.old'\r
135 \r
136 Compaction failed: Something went wrong trying to read or write a file\r
137 zsh: exit 1     ./notmuch compact\r
138 \r
139 \r
140 $ chmod 755 xapian\r
141 $ notmuch compact --backup=xapian.backup\r
142 Compacting database...\r
143 ...\r
144 ...\r
145 ...\r
146 The old database has been moved to xapian.backup.\r
147 Done.\r
148 $ ls xapian.backup\r
149 flintlock       postlist.baseB  record.baseB    termlist.baseB\r
150 iamchert        postlist.DB     record.DB       termlist.DB\r
151 postlist.baseA  record.baseA    termlist.baseA\r
152 \r
153 \r
154 ---\r
155 \r
156 Unless there are other comments I'll make new patch series where\r
157  } catch (Xapian::Error &error) { and submit it for inclusion to 0.17.\r
158 we'd better have somewhat decent 'notmuch compact' from day one.\r
159 \r
160 \r
161 Tomi\r