Glass cursor crash on empty table when doing Honey compact
Olly Betts
olly at survex.com
Mon Sep 7 01:42:03 BST 2020
On Fri, Sep 04, 2020 at 08:57:41PM +1000, Bron Gondwana wrote:
> Because the position table is empty! I'm not sure why 'kt' isn't
> being initialised.
The buffer inside the kt is allocated by basic_open(), which only
gets called if that table actually exists on disk, or when it's
first created.
> But I'm not sure if the right approach is to patch the cursor to not
> try and build a key if there's no data, or if kt should be
> initialised.
>
> Or indeed, if the Honey compactor should check for empty tables and
> just skip them without trying to create a cursor!
That's what the glass compaction code does, which is why this doesn't
affect it - that seems a reasonable way to fix this.
I want to dig into this a bit more to make sure we aren't just avoiding
a latent problem that could bite us in other situations though.
> What I think I would really like is an API to pass a hash of key/value
> metadata items into db.compact rather than having to do this
> workaround, but either way it's bad if we crash on an empty database!
It couldn't really be a hash, since we need access to keys in ascending
order.
But once honey supports update this wouldn't be needed, so I think
creating a temporary database is a reasonable workaround for now.
Cheers,
Olly
More information about the Xapian-devel
mailing list