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: [email protected]
          Reporter: [email protected]
  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/mdb.c#L2760
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.)

-- 
You are receiving this mail because:
You are on the CC list for the issue.

Reply via email to