Re: [PATCH 3/7] go: Allow notmuch objects to be garbage collected
[notmuch-archives.git] / 4d / f5db3172e8fd5c25625912af1f82e1d36a75e3
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 A7153431FAF\r
6         for <notmuch@notmuchmail.org>; Fri, 20 Jan 2012 09:18:23 -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.7\r
10 X-Spam-Level: \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 c+pLJgP7PG66 for <notmuch@notmuchmail.org>;\r
16         Fri, 20 Jan 2012 09:18:23 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
18         [18.9.25.14])\r
19         by olra.theworths.org (Postfix) with ESMTP id 0724C431FAE\r
20         for <notmuch@notmuchmail.org>; Fri, 20 Jan 2012 09:18:22 -0800 (PST)\r
21 X-AuditID: 1209190e-b7f7c6d0000008c3-b9-4f19a1de49c6\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id B2.18.02243.ED1A91F4; Fri, 20 Jan 2012 12:18:22 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q0KHIMB2026348; \r
27         Fri, 20 Jan 2012 12:18:22 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0KHILSm012234\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 20 Jan 2012 12:18:22 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1RoI6D-0006H2-Bm; Fri, 20 Jan 2012 12:18:01 -0500\r
37 Date: Fri, 20 Jan 2012 12:18:01 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH] Automatically exclude tags in notmuch-show\r
41 Message-ID: <20120120171801.GA16740@mit.edu>\r
42 References: <874nvric7c.fsf@qmul.ac.uk>\r
43         <1327010583-23954-1-git-send-email-markwalters1009@gmail.com>\r
44         <20120119225910.GT16740@mit.edu> <871uqvgrnm.fsf@qmul.ac.uk>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <871uqvgrnm.fsf@qmul.ac.uk>\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IRYrdT1723UNLf4ModdYvVc3ksrt+cyezA\r
52         5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZUz6MoWtoF2oYubq6awNjPP5uhg5OSQETCSW\r
53         bVjIBGGLSVy4t56ti5GLQ0hgH6PEwf6HTBDOBkaJ1i2rmSGck0wSLxd2sUA4Sxgl5l5axA7S\r
54         zyKgKnF18UdGEJtNQENi2/7lYLaIgI7E7UMLwGqYBaQlvv1uBtsnLGAvMXnpYmYQmxeo5vCs\r
55         l+wQQ1cwSrR3b2WFSAhKnJz5hAWiWUvixr+XQM0cYIOW/+MACXMC7brzYxpYiaiAisSUk9vY\r
56         JjAKzULSPQtJ9yyE7gWMzKsYZVNyq3RzEzNzilOTdYuTE/PyUot0jfVyM0v0UlNKNzGCAptT\r
57         km8H49eDSocYBTgYlXh4OV0l/IVYE8uKK3MPMUpyMCmJ8krOk/QX4kvKT6nMSCzOiC8qzUkt\r
58         PsQowcGsJMJb1gWU401JrKxKLcqHSUlzsCiJ86ppvfMTEkhPLEnNTk0tSC2CycpwcChJ8NYC\r
59         I1hIsCg1PbUiLTOnBCHNxMEJMpwHaHgDSA1vcUFibnFmOkT+FKOilDivE0hCACSRUZoH1wtL\r
60         PK8YxYFeEeaNAaniASYtuO5XQIOZgAZ7NImBDC5JREhJNTBmxWb2x29cFnK66b7Ghk/ep16o\r
61         8J3P3RKduVTVofGZV3VdCctbHzsRpYNiP7bPXrBmvUBiQs4kKfEXj+e1Trq6X9+Q+bvMK8dL\r
62         Mfx6Xtc3TMqOs36/Rmiae7hwlfuFqNRZ5zXN4kTWyL17uDxFZMctY86vNyU54kvfCb2a9Idz\r
63         nwebL8eVrOlKLMUZiYZazEXFiQDXLSNRFwMAAA==\r
64 Cc: notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Fri, 20 Jan 2012 17:18:24 -0000\r
78 \r
79 Quoth Mark Walters on Jan 20 at 12:10 am:\r
80\r
81 > Ok Having said this is trivial I have found a problem. What should\r
82 > notmuch do if you do something like\r
83\r
84 > notmuch show id:<some-id>\r
85 > and that message is marked with a deleted tag? To be consistent with the\r
86 > other cases (where a deleted message is in a matched thread) we might\r
87 > want to return the message with the not-matched flag set (eg in\r
88 > JSON). But my patch doesn't, as it never even sees the thread since it\r
89 > doesn't match.\r
90\r
91 > Looking at notmuch-show.c I think we should not apply the exclude tags\r
92 > to do_show_single, but usually should apply it to do_show. One solution\r
93 > which is simple and is at least close to right would be to get do_show\r
94 > to return the number of threads found. If this is zero then retry the\r
95 > query without the excludes (possible setting the match_flag to zero on\r
96 > each message since we know it does not match)\r
97\r
98 > This is not a completely correct solution as if you ask notmuch-show to\r
99 > show more than one thread it might  threads which only contain deleted\r
100 > messages.\r
101\r
102 > I can't see other good possibilities without slowing down the normal\r
103 > path a lot (eg find all threads that match the original query and then\r
104 > apply the argument above).\r
105\r
106 > Any thoughts?\r
107 \r
108 Oh dear.\r
109 \r
110 Well, here's one idea.  Instead of doing a single thread query in\r
111 show, do a thread query without the exclusions and then a message\r
112 query with the exclusions.  Output all of the messages from the first\r
113 query, but use the results of the second query to determine which\r
114 messages are "matched".  The same could be accomplished in the library\r
115 somewhat more efficiently, but it's not obvious to me what the API\r
116 would be.\r
117 \r
118 > Incidentally, is there something strange at the end of notmuch-show.c: I\r
119 > can't see how we could ever reach the last half dozen lines.\r
120 \r
121 Yes, I've wondered about that before, too.  I think none of those\r
122 technically matter since they're all cleaning up resources that the OS\r
123 is about to clean up for us.  It would be a problem if the database\r
124 was open in write mode because Xapian's write lock hangs around for a\r
125 split second after the process terminates if you don't close the\r
126 database yourself, but in read mode it doesn't take any locks.  Not\r
127 that this excuses the code.\r