Hi,
I'm writing this in the context of ArchLinux pushing LMDB 1.0 into testing.
It turns out that aside from a need to convert the LMDB databases by using 
mdb_dump before the upgrade and mdb_load to recreate them afterwards (or 
running newaliases and postmap -F again for Postfix specifically), there are 
some compatibility problems.
The first issue is that with LMDB 1.0, running either postmap or newaliases now 
causes the following message
postmap: fatal: error updating lmdb:./aliases: MDB_BAD_TXN: Transaction must 
abort, has a child, or is invalid
I looked at it with GDB, the cause for this is a change in LMDB 1.0, namely 
this commit:
ITS#8174 LMDB: fixes for mdb_drop(MAIN_DBI) · LMDB/lmdb@d0fcfd3
Dropping the MAIN_DBI now causes the transaction to be marked MDB_TXN_DIRTY and 
MDB_TXN_DROPPED, which means any further usage of the transaction that was used 
to drop MAIN_DBI will cause MDB_BAD_TXN.
For Postfix, all databases are dropped by slmdb_prepare with this statement: 
postfix/postfix/src/util/slmdb.c at v3.11.4 · vdukhovni/postfix
This causes lmdb/libraries/liblmdb/mdb.c at mdb.master3 · LMDB/lmdb to mark the 
transaction as dirty & dropped, and then when slmdb_put is called, it will call 
mdb_put with the same transaction handle here postfix/postfix/src/util/slmdb.c 
at master · vdukhovni/postfix causing MDB_BAD_TXN to be returned from here 
lmdb/libraries/liblmdb/mdb.c at mdb.master3 · LMDB/lmdb .
Now, I've made a temporary fix for Arch: Postfix LMDB 1.0 fix . 
I'm not sure this is the right approach, and it doesn't seem to fix all 
problems yet, as calling newaliases again on an already existing LMDB now 
causes duplicate key warnings, so I don't think this is right or complete just 
yet. My approach was to make slmdb_prepare to drop the database, then abort the 
transaction as is required, being a new one, and then reopen the database with 
mdb_dbi_open.
For reference, this is the downstream discussion at Arch: version 1.0.0 in 
testing breaks postfix (#5) · Issue · archlinux/packaging/packages/lmdb It 
covers LMDB 1.0 in general (other apps like bogofilter also have issues not yet 
identified), but the discussion regarding Postfix is in there, too.
But obviously, I would want to get this fixed upstream rather than doing any 
downstream patching experiments.
Regards,
Christian Pfeiffer
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to