[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#8299) LMDB mdb_del data loss when used in a cursor (new repro)

Howard Chu wrote:
> malyn@strangeGizmo.com wrote:
>> Full_Name: Michael Alyn Miller
>> Version: Git head
>> OS: Windows 8.1 x64, NixOS 14.12 x64
>> URL: ftp://ftp.openldap.org/incoming/michaelalynmiller-151103.c
>> Submission from: (NULL) (
>> I have a new repro of an ITS#8264-like situation, but with different input data
>> and with slightly different results.  Note that ITS#8264 was fixed with the
>> dataset provided in that bug; this is a different dataset and produces
>> different
>> results.
>> The referenced test runs twice: once with mdb_cursor_del and once with mdb_del.
>> Just like before, mdb_cursor_del performs correctly whereas mdb_del corrupts
>> the
>> database.  In this case, mdb_del incorrectly removes one extra key (a key
>> prefixed with 04000000000000003a...), and incorrectly leaves 21 keys in place
>> that should have been deleted (those keys begin with 05000000000000003a...).
>> This last item is the primary difference between these two bugs.
>> Unlike ITS#8264, you do not need to remove the database in between test runs in
>> order to repro this issue, although the results are still incorrect and will
>> eventually cause a bus error.
> Thanks again for the excellent bug reports. Fixed now in git.

I should also note that this is not a sensible use case. mdb_del has to 
construct a cursor to perform its work; if you already have a cursor open you 
should just use mdb_cursor_del. mdb_del is meant for one-shot use and is much 
slower than mdb_cursor_del when used in an iteration.

   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/