Database left unlocked by Tcl bindings

Olly Betts olly at survex.com
Sun Feb 21 22:33:22 GMT 2016


On Sun, Feb 21, 2016 at 02:15:25PM +0100, Eric J wrote:
> I discovered, while trying to set up Tcl bindings for Notmuch
> (https://notmuchmail.org/), which uses Xapian, that flintlock was not
> being locked (I had lost updates).

It seems to work for me, testing with this:

package require Tcl 8
package require xapian 1.0.0
xapian::WritableDatabase db "tmp.db" $xapian::DB_CREATE_OR_OPEN
xapian::WritableDatabase db2 "tmp.db" $xapian::DB_CREATE_OR_OPEN

I wonder if the problem is unrelated to locking, but instead it's that
the Tcl database doesn't get explicitly destroyed in your script, so
that the C++ object doesn't either, and the changes don't get committed.

I would try calling close() on the WritableDatabase object before your
script exits.

There's some discussion of this in the Tcl bindings docs (section
"Destructors"):

https://xapian.org/docs/bindings/tcl8/

Cheers,
    Olly



More information about the Xapian-discuss mailing list