I had already posted on here a couple of days ago on the matter but it got 
missed or so. Anyway, the problem is a singular change to mdb_drop(), commit 
d0fcfd3d02321d04b56a23e6c86c80309f4ecef5 in mdb. It was made to fix bug 
ITS#8174 in LMDB. The consequence is that now you cannot reuse a transaction 
handle that was used to drop MAIN_DBI. Postfix does this in slmdb_prepare(), 
dropping ALL databases, including MAIN_DBI. This handle then causes MXN_BAD_TXN 
on its next usage, breaking newaliases and co. The transaction handle would 
need to be aborted and then the transaction reopened. The patch I made for Arch 
downstream patch that has been in this thread already does precisely that. It 
only changes slmdb_prepare() and works. I've been running Postfix 3.11.4 with 
that patch for a few days now without issue. However, there's still one more 
glitch or so with it that I haven't debugged yet. That's why I had asked for 
comments in my mail a few days ago.



On Sunday, July 05, 2026 15:58 CEST, Edmund Lodewijks via Postfix-users 
<[email protected]> wrote:

 
On 2026/07/05 13:19, Wietse Venema via Postfix-users wrote:
> Michael Grimm via Postfix-users:
>> Well, I will stick with lmdb 0.9.35 for the time being or migrate
>> to other database formats, instead.
> 
> Way to go if you have that option.

I can see two ways to patch for this in Postfix:

1) Instead of dropping the table, walk a cursor and delete each record 
in place. This is much more expensive than the current method, but I 
think it the cost will still be negligible. The most expensive 
transaction is when you run postmap/ postalias.

The nice thing about this is that it seems to me to be the least 
invasive patch, with as little change as possible. Most of the current 
structure stays the same. Importantly, atomicity is retained in the same 
way that it currently exists. This is also compatible with lmdb 0.9.x.

An example patch is attached (not sure if the mailing list allows 
attachments).

2) Alternatively, create a new table in a temp file + rename. There 
would be more code involved for this, and a temp file (if you want to do 
this securely, and not with a predictable name) introduces all kinds of 
file permissions things to take care off across multiple OS's. This, 
too, is compatible with lmdb 0.9.x.

I hope this is useful.

Kind regards,
Edmund


-- 
Edmund Lodewijks <[email protected]>
TZ: UTC+2 / GMT+2



 
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to