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.)
https://bugs.openldap.org/show_bug.cgi?id=9447
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #1 from Howard Chu hyc@openldap.org --- The code works as designed. You are expected to set either mdb_debug or mdb_debug_start manually in a debugger (like gdb).
https://bugs.openldap.org/show_bug.cgi?id=9447
--- Comment #2 from Per.Mildner@ri.se --- Thanks.
This is not clear from the documentation of MDB_DEBUG which only says "Enable debug output. ... Set this to 1 for copious tracing..." and does not mention mdb_debug or mdb_debug_start.
https://bugs.openldap.org/show_bug.cgi?id=9447
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED