From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 14 Aug 2012 17:22:06 +0000 (+0200) Subject: Re: ‘class Xapian::Database’ has no member named ‘close’ X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=30c0d768ca99ae3cd746987697c510c5be15609b;p=notmuch-archives.git Re: ‘class Xapian::Database’ has no member named ‘close’ --- diff --git a/3f/6d33cf8b6d0332715851098e084a3ee3cb0ee5 b/3f/6d33cf8b6d0332715851098e084a3ee3cb0ee5 new file mode 100644 index 000000000..c7f4fde4b --- /dev/null +++ b/3f/6d33cf8b6d0332715851098e084a3ee3cb0ee5 @@ -0,0 +1,94 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 943E7431FC2 + for ; Tue, 14 Aug 2012 10:22:13 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id xm95IG9l+PeQ for ; + Tue, 14 Aug 2012 10:22:13 -0700 (PDT) +Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DF668431FAE + for ; Tue, 14 Aug 2012 10:22:12 -0700 (PDT) +Received: from mail.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.cryptobitch.de (Postfix) with ESMTPSA id 58BA85A9030 + for ; Tue, 14 Aug 2012 19:22:11 +0200 (CEST) +Received: by mail.jade-hamburg.de (Postfix, from userid 401) + id 3B1FCDF2A4; Tue, 14 Aug 2012 19:22:11 +0200 (CEST) +Received: from thinkbox.jade-hamburg.de (unknown + [IPv6:2002:55b7:be4:1:213:e8ff:fe51:7a89]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) (Authenticated sender: teythoon) + by mail.jade-hamburg.de (Postfix) with ESMTPSA id 1D638DF2A1; + Tue, 14 Aug 2012 19:22:08 +0200 (CEST) +Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.80) + (envelope-from ) + id 1T1Koh-0004th-3I; Tue, 14 Aug 2012 19:22:07 +0200 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +From: Justus Winter <4winter@informatik.uni-hamburg.de> +User-Agent: alot/0.3.2+ +To: Jani Nikula , Michal Nazarewicz , + David Bremner , notmuch@notmuchmail.org +References: + <87a9xx4yuj.fsf@maritornes.cs.unb.ca> + <87fw7p1viu.fsf@nikula.org> +In-Reply-To: <87fw7p1viu.fsf@nikula.org> +Message-ID: <20120814172206.12994.63545@thinkbox.jade-hamburg.de> +Subject: + =?utf-8?q?Re=3A_=E2=80=98class_Xapian=3A=3ADatabase=E2=80=99_has_no_membe?= + =?utf-8?q?r_named_=E2=80=98close=E2=80=99?= +Date: Tue, 14 Aug 2012 19:22:06 +0200 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 14 Aug 2012 17:22:13 -0000 + +Quoting Jani Nikula (2012-08-14 14:57:13) +> > Is close() really required though? The comment justifies it saying +> > that: +> > +> > Many Xapian objects hold references to the database, so merely +> > deleting the database may not suffice to close it. Thus, we +> > explicitly close it here. +> > +> > but wouldn't the database get closed when the last reference gets +> > deleted anyway? + +Yes, it is. + +> IIRC this was related to how closing is handled in the python +> bindings. + +Well this issue isn't in anyway specific to the python bindings, but +in c you can determine exactly whether a database has been closed +because this only happens if you explicitly destroy the database +object. In any garbage collected language you have to wait for the +object to be collected and this is usually not easy to detect. + +So we decided to explicitly close the database and to split +..database_destroy in ..database_close and ..database_destroy later +on. + +Justus