[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7774) LMDB assertion failure during Postfix cache cleanup



Wietse Venema writes:
> As written in the bug report the assertion also failed with
> mdb_map_size set to an insanely large value (half a billion) in
> which case the map size never changes.

Yes...

> But, it is good to know that the cursor is invalidated by both map
> size changes and transactions that change the database.

No, that's the wrong idea.  This is a case of a user error breaking
snapshot isolation:  Ending the transaction invalidates its cursors,
and you have to end the transaction in these two cases (modifying
when using MDB_NOLOCK, or resizing).

Those are "user errors" because that made it simple to code those
features.  We could add code to make them non-errors on in common cases
and on common hosts, but I'm not sure if that's worth the trouble.

> I can confirm that with LMDB-0.9.10 + ITS#7756 patch, the assertion
> failure goes away when I close the cursor (and its read transaction)
> before changing the map or the database, and restore the cursor
> afterwards. I guess this got broken when things were changed to use
> external locks in order to avoid world-writable lockfiles.

Yes.

Ending the read-only transaction and starting a new one means you are
no longer seeing the same snapshot, though.  So I hope the reason you
couldn't use single transaction which I suggested previously, was that
the reader transaction needed to keep seeing the same snapshot.

-- 
Hallvard