unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* ‘class Xapian::Database’ has no member named ‘close’
@ 2012-08-07 15:23 Michal Nazarewicz
  2012-08-14  9:17 ` David Bremner
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Nazarewicz @ 2012-08-07 15:23 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]

Hi guys,

when I'm trying to build notmuch on Ubuntu Lucid, I'm getting the
following error:

lib/database.cc: In function ‘void notmuch_database_close(notmuch_database_t*)’:
lib/database.cc:767: error: ‘class Xapian::Database’ has no member named ‘close’

I'm solving that by:

diff --git a/lib/database.cc b/lib/database.cc
index 761dc1a..fd78135 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -764,7 +764,7 @@ notmuch_database_close (notmuch_database_t *notmuch)
      * close it.  Thus, we explicitly close it here. */
     if (notmuch->xapian_db != NULL) {
 	try {
-	    notmuch->xapian_db->close();
+	    /* notmuch->xapian_db->close(); */
 	} catch (const Xapian::Error &error) {
 	    /* do nothing */
 	}

which does not seem to break anything.  The Xapian packages installed on
my machine:

$ dpkg -l |grep xapian
ii  apt-xapian-index  0.25ubuntu2      maintenance tools for a Xapian index of Debi
ii  libxapian-dev     1.0.18-1         Development files for Xapian search engine l
ii  libxapian15       1.0.18-1         Search engine library
ii  python-xapian     1.0.17-1ubuntu1  Xapian search engine interface for Python

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: ‘class Xapian::Database’ has no member named ‘close’
  2012-08-07 15:23 ‘class Xapian::Database’ has no member named ‘close’ Michal Nazarewicz
@ 2012-08-14  9:17 ` David Bremner
  2012-08-14 12:26   ` Michal Nazarewicz
  0 siblings, 1 reply; 5+ messages in thread
From: David Bremner @ 2012-08-14  9:17 UTC (permalink / raw)
  To: Michal Nazarewicz, notmuch

Michal Nazarewicz <mina86@mina86.com> writes:
>
> $ dpkg -l |grep xapian
> ii  apt-xapian-index  0.25ubuntu2      maintenance tools for a Xapian index of Debi
> ii  libxapian-dev     1.0.18-1         Development files for Xapian search engine l
> ii  libxapian15       1.0.18-1         Search engine library


Hi Michal;

This might be a bug with the install documentation; it could be we
really need a later xapian to build. From memory, maybe 1.0.20 has the
"close" method. 1.0.18 is pretty old; Debian squeeze has 1.2.3, and that
must be almost 3 years old now.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ‘class Xapian::Database’ has no member named ‘close’
  2012-08-14  9:17 ` David Bremner
@ 2012-08-14 12:26   ` Michal Nazarewicz
  2012-08-14 12:57     ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Nazarewicz @ 2012-08-14 12:26 UTC (permalink / raw)
  To: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]

> Michal Nazarewicz <mina86@mina86.com> writes:
>> $ dpkg -l |grep xapian
>> ii  apt-xapian-index  0.25ubuntu2      maintenance tools for a Xapian index of Debi
>> ii  libxapian-dev     1.0.18-1         Development files for Xapian search engine l
>> ii  libxapian15       1.0.18-1         Search engine library

David Bremner <david@tethera.net> writes:
> This might be a bug with the install documentation; it could be we
> really need a later xapian to build.

Yeah, it seems that INSTALL claims “Notmuch will work best with Xapian
1.0.18 (or later) or Xapian 1.1.4 (or later)”, which doesn't seem to be
the case.

On top of that, configure does not seem to even check the version
number.

> From memory, maybe 1.0.20 has the "close" method. 1.0.18 is pretty
> old; Debian squeeze has 1.2.3, and that must be almost 3 years old
> now.

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?

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ‘class Xapian::Database’ has no member named ‘close’
  2012-08-14 12:26   ` Michal Nazarewicz
@ 2012-08-14 12:57     ` Jani Nikula
  2012-08-14 17:22       ` Justus Winter
  0 siblings, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2012-08-14 12:57 UTC (permalink / raw)
  To: Michal Nazarewicz, David Bremner, notmuch

On Tue, 14 Aug 2012, Michal Nazarewicz <mina86@mina86.com> wrote:
> Yeah, it seems that INSTALL claims “Notmuch will work best with Xapian
> 1.0.18 (or later) or Xapian 1.1.4 (or later)”, which doesn't seem to be
> the case.
>
> On top of that, configure does not seem to even check the version
> number.

Someone(tm) should fix both of the above.

> 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?

IIRC this was related to how closing is handled in the python
bindings. The close was introduced in the commit below, not too long
ago. I just reverted that one when I had to use notmuch with ancient
xapian (but the usual disclaimers apply).

BR,
Jani.


commit cfc5f1059aa16753cba610c41601cacc97260e08
Author: Justus Winter <4winter@informatik.uni-hamburg.de>
Date:   Fri Mar 2 15:58:39 2012 +0100

    Actually close the xapian database in notmuch_database_close
    
    Formerly the xapian database object was deleted and closed in its
    destructor once the object was garbage collected. Explicitly call
    close() so that the database and the associated lock is released
    immediately.
    
    The comment is a courtesy of Austin Clements.
    
    Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ‘class Xapian::Database’ has no member named ‘close’
  2012-08-14 12:57     ` Jani Nikula
@ 2012-08-14 17:22       ` Justus Winter
  0 siblings, 0 replies; 5+ messages in thread
From: Justus Winter @ 2012-08-14 17:22 UTC (permalink / raw)
  To: Jani Nikula, Michal Nazarewicz, David Bremner, notmuch

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-14 17:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-07 15:23 ‘class Xapian::Database’ has no member named ‘close’ Michal Nazarewicz
2012-08-14  9:17 ` David Bremner
2012-08-14 12:26   ` Michal Nazarewicz
2012-08-14 12:57     ` Jani Nikula
2012-08-14 17:22       ` Justus Winter

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).