https://bugs.openldap.org/show_bug.cgi?id=9447
Issue ID: 9447 Summary: Defining MDB_DEBUG has no effect Product: LMDB Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: liblmdb Assignee: bugs@openldap.org Reporter: Per.Mildner@ri.se Target Milestone: ---
I tried to compile mdb.c with -DMDB_DEBUG=2 to get some debug output, but nothing was written.
Looking at mdb.c it looks as if the code block that sets the mdb_debug static flag should be moved to above the line that does txn->mt_txnid++; (since mt_txnid is unsigned and mdb_debug_start starts out as zero and is never changed, so txn->mt_txnid+1 would never be zero unless it wraps around or is initialized to (size_t)-1 somewhere).
Moving the code block does indeed cause a lot of debug messages to be written.
This is lmdb 5b75edb6337b28669c1370bc33442e272e72f91a but looking at the git history it looks as if the code has been the same since mdb_debug was introduced so perhaps the code never worked.
The code at https://git.openldap.org/openldap/openldap/-/blob/master/libraries/liblmdb/m... looks like:
txn->mt_txnid++; #if MDB_DEBUG if (txn->mt_txnid == mdb_debug_start) mdb_debug = 1; #endif
(I am new to the code and to lmdb so apologies if I missed something obvious.)