[Xapian-devel] Xapian::Database->close() for perl missing
Olly Betts
olly at survex.com
Sat Apr 21 23:20:54 BST 2012
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.
> > 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.
Cheers,
Olly
More information about the Xapian-devel
mailing list