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

RE: (ITS#8300) LMDB mdb_cursor_del data loss

> >> Another issue similar to ITS#8264 and ITS#8299, but this time using
> >> mdb_cursor_del inside of the cursor causes corruption.  mdb_del
> >> causes corruption as well, but this is the first time that I have
> >> seen mdb_cursor_del do the wrong thing.
> >>
> >> In this case, mdb_cursor_del incorrectly removes one extra key (a key
> >> prefixed with 0c000000000000003a...) in addition to correctly
> >> removing all of the keys that begin with 0d000000000000003a.
> >>
> >> mdb_del does not remove that extra key, but instead fails to remove
> >> two 0d000000000000003a keys that should have been removed.
> >>
> >> I am not sure if these are two different bugs or if they are caused
> >> by the same underlying issue.
> >
> > Similar reason, two different mistakes. Fixed now in git.
> >>
> >> mdb_cursor_del performs correctly on subsequent runs if you do *not*
> >> remove the database between tests, whereas mdb_del continues to fail,
> >> but stabilizes on a different set of results after the first run.
> For future reference, here's a patch to your test program that also check=
s for
> cursors pointed adjacent to the item being deleted. The previous fix was
> missing a step, fixed now. Note you must build LMDB with -DMDB_DEBUG
> for the mdb_cursor_chk() function to be defined.

Just to confirm, are you saying that this is something that I should includ=
e only in the test harness, or should these checks be in my actual library =
as well?

Thank you for taking the time to work through these bugs and address all of=
 the various edge cases.  I really appreciate the help.

Michael Alyn Miller