[Xapian-devel] Xapian::Database->close() for perl missing

Websuche :: Felix Ostmann ostmann at websuche.de
Mon Apr 23 10:23:18 BST 2012


2012/4/22 Olly Betts <olly at survex.com>

> On Fri, Apr 20, 2012 at 02:17:24PM +0200, Websuche :: Felix Ostmann wrote:
> > 2012/4/20 Olly Betts <olly at survex.com>
> >
> > > On Thu, Apr 19, 2012 at 03:45:36PM +0200, Websuche :: Felix Ostmann
> wrote:
> > > > /path/to/index/20120419010000
> > > > /path/to/index/20120419020000
> > > > /path/to/index/20120419030000
> > > > /path/to/index/default => /path/to/index/20120419030000
> > >
> > > Note that using symlinks for this isn't recommended - Xapian opens the
> > > files using the given path, so if it is in the middle of opening the
> > > database when you switch the symlink, it'll try to open half the old
> > > one and half the new one, which isn't good at all.
> > >
> > > It's better to use a stub database file instead.
> >
> > The problem with the symlink is correct, but will only break 1 request
> when
> > the system starts and that also only in theory. If such a open occure,
> the
> > next request will close & open again (because the mtime of the iamchert
> is
> > now newer).
>
> If requests are serviced in parallel, it can break more than one.  It
> isn't going to be a huge issue if you only switch over the database
> hourly, but why suffer it at all when you don't need to?
>
> > I cannot follow your meaning of a stub-database, what do you mean?
>
> The link James provided is good.
>

OK, so one example:

- create a new database ( /path/to/databases/xapian-index-3 )
- create a new stub-file in the database directory with absolute file names
and without symlinks ( /path/to/databases/xapian-index-3/stub )
- delete and create a default-database symlink to this database (
/path/to/databases/default => /path/to/databases/xapian-index-3 )
- check befor every request the modtime of the stub-file in the
default-database and if newer close / open the database via stub-file




>
> > > If you destroy all references to the database, it should get closed, so
> > > this suggests that either the Perl bindings aren't keeping track of the
> > > references correctly, or there's an object you have around still with a
> > > reference to the Database (keeping an Enquire or MSet or TermIterator
> or
> > > similar will implicitly keep a reference to the database).
> >
> > Perhaps i missed a reference, but i override the database, enquire and
> > queryparser-object with there new one after a new open. No other objects
> > should survive there scope.
>
> It might be a reference tracking bug in the perl bindings, but without
> seeing the code it's hard to say (or find it if that's the issue).  If
> you want to track it down (whether it is in the bindings or your own
> code), I'd add a line of code to print out the pointer value after each
> "new" of a Xapian object and before each "delete", and then see if any
> don't match up.
>

i tried to reproduce it within a small snipit, but all out of scope and
object-override destroys works as expected. So perhaps it is really a local
problem with my code + Mojolicious. ->close help in my code so i am fine.



>
> Cheers,
>    Olly
>



-- 
Mit freundlichem Gruß
Felix Ostmann

-----------------------------------------------------------
Websuche Search Technology GmbH & Co. KG
Martinistraße 3, D-49080 Osnabrück, Germany
-----------------------------------------------------------
Tel.: +49 (0) 541 / 40666 0, Fax: +49 (0) 541 / 40666 22
Email: info at websuche.com, Web: www.websuche.com
-----------------------------------------------------------
AG Osnabrück - HRA 200252, Ust-IdNr.: DE814737310
-----------------------------------------------------------
Komplementärin: Websuche Search Technology Verwaltungs GmbH
AG Osnabrück - HRB 200359, Geschäftsführer: Ansas Meyer
-----------------------------------------------------------

Die in dieser Email enthaltenen Informationen sind vertrau-
lich zu behandeln und ausschließlich für den Adressaten be-
stimmt. Jegliche Veröffentlichung, Verteilung oder sonstige
in diesem Zusammenhang stehende Handlung  wird ausdrücklich
untersagt.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20120423/5a5d076b/attachment.htm>


More information about the Xapian-devel mailing list