Re: Avoiding the "huge INBOX of death"
[notmuch-archives.git] / 57 / 5ebe81ccb3a3f19e39fd59b7e186a1ca995c8f
1 Return-Path: <olly@survex.com>\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 33060431E64\r
6         for <notmuch@notmuchmail.org>; Wed, 29 Feb 2012 13:19:29 -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: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] 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 MMKVcRo9quLs for <notmuch@notmuchmail.org>;\r
16         Wed, 29 Feb 2012 13:19:28 -0800 (PST)\r
17 Received: from atreus.tartarus.org (atreus.tartarus.org [80.252.125.10])\r
18         (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 48740431FAE\r
21         for <notmuch@notmuchmail.org>; Wed, 29 Feb 2012 13:19:28 -0800 (PST)\r
22 Received: from olly by atreus.tartarus.org with local (Exim 4.69)\r
23         (envelope-from <olly@survex.com>)\r
24         id 1S2qvi-00067j-MC; Wed, 29 Feb 2012 21:19:22 +0000\r
25 Date: Wed, 29 Feb 2012 21:19:22 +0000\r
26 From: Olly Betts <olly@survex.com>\r
27 To: Austin Clements <amdragon@MIT.EDU>\r
28 Subject: Re: [PATCH] Actually close the xapian database in\r
29         notmuch_database_close\r
30 Message-ID: <20120229211922.GQ24964@survex.com>\r
31 References:\r
32  <1330507157-22859-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
33         <1330507157-22859-2-git-send-email-4winter@informatik.uni-hamburg.de>\r
34         <20120229154833.GB772@mit.edu>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain; charset=us-ascii\r
37 Content-Disposition: inline\r
38 In-Reply-To: <20120229154833.GB772@mit.edu>\r
39 User-Agent: Mutt/1.5.18 (2008-05-17)\r
40 Cc: notmuch@notmuchmail.org\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Wed, 29 Feb 2012 21:19:29 -0000\r
54 \r
55 On Wed, Feb 29, 2012 at 10:48:33AM -0500, Austin Clements wrote:\r
56 > Quoth Justus Winter on Feb 29 at 10:19 am:\r
57 > > Formerly the xapian database object was deleted and closed in its\r
58 > > destructor once the object was garbage collected. Explicitly call\r
59 > > close() so that the database and the associated lock is released\r
60 > > immediately.\r
61\r
62 > Interesting.  Is this a bug in Xapian?  According to the docs,\r
63 > ~Database is supposed to close the database (if there are no other\r
64 > copies, which there shouldn't be), so this should be redundant with\r
65 > the delete notmuch->xapian_db a few lines down, but your experience\r
66 > obviously suggests that it isn't and I can't find the code path in\r
67 > Xapian that would close it in the destructor.\r
68 \r
69 Most Xapian API classes (including Database and WritableDatabase) just\r
70 hold a reference-counted pointer, and so it's the destructor of the\r
71 reference-counted object which closes the database.  If "PIMPL" means\r
72 anything to you, that's what we have here.\r
73 \r
74 Some other API classes objects (such as PostingIterator) internally hold\r
75 a reference to the database they are using, so calling close()\r
76 explicitly is useful if you don't want to have to worry about such\r
77 objects still existing and holding onto references which keep the\r
78 database open.\r
79 \r
80 The main motivation for adding close() was the bindings though - e.g. in\r
81 Python the wrapped Database object gets destroyed when the GC gets run,\r
82 which is at some essentially arbitrary time after you remove the last\r
83 reference to it.\r
84 \r
85 It is hard to say if calling close() is actually useful here from just\r
86 seeing the patch.\r
87 \r
88 Cheers,\r
89     Olly\r